Robert Klemme
9/2/2008 11:11:00 AM
2008/9/1 Patrick Li <patrickli_2001@hotmail.com>:
> The reason instance_eval shouldn't be used in that way is because it
> interferes with your scope in a very unintuitive way.
>
> For example, you can't do something like this:
>
> @source = "pic.gif"
> html do
> image(@source)
> end
>
> You have to do something like this:
> source = @source
> html do
> image(source)
> end
That's true. I have to admit that I can't remember having seen this
as a problem - it's probably a matter of programming style.
> The reason, also, that I ask for a simpler syntax for procs, is so that
> we can eliminate the kludgy block argument syntax. I like Ruby, but I
> feel it's power is limited because of the complexity of it's syntax.
Umm, I have always thought of Ruby's syntax as clean and simple. :-)
You still have not explained how you would avoid the ambiguity with
your simple syntax...
> Smalltalk is *almost* like Ruby, except that it treats blocks (or
> closures as they call it) consistently, which makes it possible to write
> many control structures.
Well, you do not _have_ to use Ruby... If I would constantly miss
features of another language X this would be the very moment when I'd
start considering using X instead of Ruby. And if it happens only
from time to time I'd rather try to find a workable alternative vs.
changing the language. My 0.02 EUR.
Kind regards
robert
--
use.inject do |as, often| as.you_can - without end