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?
> say a => 3
(no output)
> say 'a' => 3
a 3
> say (hash('a' => '3' )).perl
{"a" => "3"}
...
> 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)?
Or does it become just 3, or just 4, or (ow) 3|4...
while we're at it, how do tell "hash()" to create a hash with a pair as a key?
> say hash({'y'=>6},4)
Odd number of elements found where hash expected