On Tue, 16 Jul 2002, John Porter wrote:

> In his P6 Summary for 2002-07-14, in section 
> "Perl 6 grammar, take 5", Piers says:
> 
>     someone pointed out that [the grammar] had a problem
>     with code like
> 
>        { some_function_returning_a_hash() }
> 
>     Should it give a closure? Or a hash ref?
>     Larry hasn't commented so far.
> 
> I couldn't find where anyone said any such thing,
> but regardless, it's still a good question.
> 
> I believe it should give a hash ref, for two (related)
> reasons:
> 
>   a. it is the more common case.  Better Huffman coding.

Too bad its a closure, then.  A4 says that bare braces will be a closure 
unless they conatin a pair constructor => at the top level.

I imagine bare braces without a 
pair construcor referring to a closure is more common than constructing a 
hashref... in Perl 6, that is. (That's just a guess, though).

>   b. there is a word to make it a closure explicitly
>      which the programmer can add if that's what she
>      wants.  No such word (AFAIK) does the same for
>      a hash ref.

C<sub> makes a closure. C<hash> makes a hashref.  So there is a word.

> And if this is something that has already been hashed out,
> never mind. :-)

It is.  Well, I minded anyway. 

Luke

Reply via email to