Hi --

On Wed, 23 Nov 2005, Jeff Wood wrote:

> Heh, and to think the only reason I did it was because I figured just having
> the { [] } would confuse things ( badly formed hash declaration ) so I put
> the goalposts in just to be sure that it saw things as a block body ...
>
> I'll gladly take credit, I'm glad I'll be remembered for something now (
> heh, need to get that into the rubyscore app )... for my "empty goalpost"
> strategem ;) . I'm not Dave Thomas or DHH or _why ... or matz ... or any of
> the countless others that have helped me better myself as a Rubyist, but
> hopefully one day I'll get to have a big impact ... and pay them all back. I
> thank you all everyday I get to play with Ruby.
>
> Anyways, You could seperate them if you didn't want them to look like or ...
> like ...
>
> { | | [] } ... although that's kinda ugly to me.

No argument there :-)

> I'd be just as happy to use the new block syntax ->{ [] } ... when is that
> going to see the light of day ???

I think I'm not alone is saying: hopefully never :-)  Anyway, you can
just do:

   Hash.new { [] }

It's a pretty common idiom, and the block is unambiguously a block.
(If it were a hash argument it would have to be in parentheses.)


David

-- 
David A. Black
dblack / wobblini.net