develooper Front page | perl.perl6.internals | Postings from August 2002

Re: [netlabs #801] [PATCH] PerlArray in scalar context

Thread Previous | Thread Next
David M. Lloyd
August 14, 2002 10:32
Re: [netlabs #801] [PATCH] PerlArray in scalar context
Message ID:
On Fri, 12 Jul 2002, Sean O'Rourke wrote:

> # New Ticket Created by  "Sean O'Rourke"
> # Please include the string:  [netlabs #801]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> This patch makes the following behave as it does in Perl 5:
> @a = 1..3; @b = 1..3;
> $x = @a + @b;		# x is 6 in Perl 5, undef in Parrot
> The problem was that the math vtable methods were giving up if the other
> side of the operator wasn't an int or a num.  So the current version of
> PerlArray would make $x undef.  I'm not sure getting the other thing's
> int value (as opposed to its num value) is the right thing, but it seems
> like a reasonable guess.

Something tells me this approach isn't quite right but I don't know what.
It seems odd that, for instance, @a decides what context to take @b in.
How do we say 'scalar context' in Parrot?  What if @b is "Blah" in scalar
context?  Does it return 0 then?

Anyone with more powerful Jedi skills want to bless this patch?

- D


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About