Re: RFC 118 (v1) lvalue subs: parameters, explicit assignment, and wantarray() changes

[email protected] (Chaim Frenkel) 20 Aug 2000 00:38:05 -0400
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
>>>>> "GB" == Graham Barr <[email protected]> writes:

GB> On Fri, Aug 18, 2000 at 12:25:42AM -0400, Chaim Frenkel wrote:
>> As Graham pointed out, is an lvalue sub supposed to act like a tie or
>> like a variable.

GB> Both.

GB> As Damian points out the lvalue sub must return something that can
GB> be used as an lvalue. Normal assignment hen happens.

GB> So the result will be the same as assigning to a variable, if that
GB> variable is tied it can change the resutl value of the assign.

I think we agree.

$foo is a tied variable
$bar is a normal variable

	sub zap : lvalue { return $_[0] ? $foo : $bar }

	zap(1) = 5;	# Goes to tied variable
	zap(0) = 5;	# Normal store

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