yary wrote:
> On Mon, May 4, 2009 at 1:45 PM, Patrick R. Michaud via RT
> <[email protected]> wrote:
>> <moritz_> rakudo: say (hash(a => '3' )).perl
>
> should that be "say (hash('a' => '3' )).perl" - is the bareword a intentional?
Yes, it's intentional.
>> In particular, while we might expect list(1,2,x=>3,4) to give us a
>> list of three elements, syntactically the above has only three
>> positional arguments and a named argument 'x'. It's not clear how
>> list() should function in that case.
>>
>> With hash() it might be a bit easier -- we simply use all of the named
>> arguments as part of constructing the hash. But ordering becomes a bit
>> of an issue -- what to do with...?
>>
>> hash('x' => 3, 'x', 4)
>>
>> Does the resulting entry for 'x' become [3, 4] or [4, 3]? Or do we need
>> to know the relative ordering of the named/positional arguments (as in
>> list() above)?
I see your point, but I'd still prefer the simple hash(a => 3) thing to
work for now ;-)
> Or does it become just 3, or just 4, or (ow) 3|4...
Surely not 3|4. (Why should we prefer an any() junction about all the
other junctions?)
> while we're at it, how do tell "hash()" to create a hash with a pair as a key?
>> say hash({'y'=>6},4)
hash((a => 2) => 3)
Note that this stringifies the pair.
Cheers,
Moritz