Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go

[email protected] (Chaim Frenkel) 03 Sep 2000 17:06:08 -0400
Newsgroups perl.perl6.language.flow
Message-ID <[email protected]>
>>>>> "TC" == Tom Christiansen <[email protected]> writes:

>> I don't want to jam a list into anything. I want it to remain a list.
TC> Then it won't fit.  Don't you understand?  YOU CANNOT LET IT REMAIN
TC> A LIST AND PUT ALL THOSE THINGS IN A SCALAR SLOT.

>> sub fn { return (3,5,7) }
>> $x = fn;	# I want  $x==3

Let me try once more. I want that fn() to act like
   sub fn { my @a = (3,5,7); return @a}

You are letting the scalar context of the caller to bleed through the return
and effect the _syntatic_ meaning of the comma.

TC> This is not a new concept, nor an isolated one.  Here's another list:
TC>     $x = @ENV{HOME,USER,TERM};

Not the same. I'm only interested in action-at-a-distance. Where there
is a sub and a return in between. I have no objection to that.

TC> Sure, there are functions that can do those things, but these
TC> aren't functions who get to be quirky.  This is completely
TC> expected.

To you perhaps. I feel that the syntactical change is unexpected.

But do you any objectsions to making this limited change? When the
EXPR of a return is a literal list, it should not have its comma
changed?

Will my proposal bleed into anything else in the language?

<chaim>
-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
[email protected]				               +1-718-236-0183