develooper Front page | perl.perl6.language.flow | Postings from September 2000

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

From:
Chaim Frenkel
Date:
September 3, 2000 14:06
Subject:
Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go
Message ID:
m3n1hpgp8f.fsf@csamnycln01.nyc.csam.com
>>>>> "TC" == Tom Christiansen <tchrist@chthon.perl.com> 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.
chaimf@pobox.com				               +1-718-236-0183



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About