----- Original Message -----
From: "Larry Wall" <[EMAIL PROTECTED]>
To: "Perl6" <[EMAIL PROTECTED]>
Sent: Wednesday, January 21, 2004 2:51 PM
Subject: [perl] Re: Comma Operator
> On Tue, Jan 20, 2004 at 08:12:28PM -0800, Jonathan Lang wrote:
> : Joe Gottman wrote:
> : > About a month ago, a thread here suggested that we change the
meaning
> : > of the comma operator. Currently, in scalar context the expression
> : > foo(), bar()
> : > means "evaluate foo(), discard the result, then return the value of
> : > bar()".
> : > It was suggested that this be changed to return the 2-element array
> : > (foo(), bar()). Has Larry ruled on this yet?
> :
> : Not that I'm aware of. For the most part, the previous discussion was
> : focusing on what to replace the comma with in the case of "discard all
but
> : the last result", and my impression was that any ruling on the change
> : would likely be contingent on the presence or absence of a suitable
> : replacement.
>
> I'm a little frustrated because I feel like I've ruled on it several
> times, but it never seems to "stick". I guess that's because it was
> never ruled in an Apocalypse, just in email. But I'm sure I'm on
> the record somewhere saying that I think [-1] is sufficient to pick
> out the last element of a list. If nothing else, just a couple of
> days ago, but I'm sure I also said it more than once in ancient times.
>
Great, so
$x = foo(), bar();
means the same thing as
$x = ( foo(), bar() );
Is the optimizer going to be smart enough so that given the expression
$x = (foo(), bar(), glarch())[-1];
Perl6 won't have to construct a three-element array just to return the last
element?
Joe Gottman