Short Functions

Jason Orendorff jason.orendorff at gmail.com
Mon May 23 08:38:07 PDT 2011


On Sun, May 22, 2011 at 7:35 PM, Brendan Eich <brendan at mozilla.com> wrote:
> On May 22, 2011, at 5:21 PM, Isaac Schlueter wrote:
>> Yes, I guess we are pushing opinions at each other.  I'd say that they
>> are that bad.
>>
>> I have experience only with Ruby, not SmallTalk or E.  Maybe they're
>> handled better in the other two?
>
> Could you say more than "that bad", precisely how and why and wherefore, an example or three, about your Ruby experience?

Oh, I disliked Ruby blocks at first because tutorial after tutorial
left me with no real understanding of the feature. I was totally
unable to predict what would happen in any slightly unusual case. I
had to try it and see. I blame myself for looking at tutorials when I
should've been looking at source code, but I also blame the tutorials
for taking the attitude "and if you call a block after the enclosing
method exits, um.... hey look, cartoon foxes!"

Today I understand continuations better. I would be able to guess the
answers (with fewer trials, not zero) and I wouldn't be so frustrated.
Not everybody has that background though.

Another possible gripe is that Ruby blocks are syntactically special.
They're not expressions.
  [1, 2, 3].collect {|i| i + 1}  # ok
  x = {|i| i + 1}  # syntax error
This compounds the first problem by making them a bit harder to play
with in the REPL. In Smalltalk, as in your straw-man, blocks are just
expressions. That seems much better--but I'd like to know why Ruby
went the other way.

-j


More information about the es-discuss mailing list