Re: RFC 154 (v1) Simple assignment lvalue subs should be on by default

[email protected] (Chaim Frenkel) 24 Aug 2000 14:47:28 -0400
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
>>>>> "PRL" == Perl6 RFC Librarian <[email protected]> writes:

PRL> The key to the proposal is this: lvalue and rvalue versions of a sub
PRL> would work I<identically>, and both would be enabled by default.
PRL> I<However>, assignment is the only valid operator for these default
PRL> lvalue subs. Attempts to use other operators, such as ++ or s/// on
PRL> these subs would yield an error like:

PRL>    Attempt to modify simple lvalue sub, only = is allowed

Why this limitation?

Once perl has the object/reference/pointer to the lvalue, perl should
be free to modify it at will.

If the lvalue is a fundemental type (whatever that is) everything works
as if the lvalue were actually in place

	sub foo { return $a }
	foo =~ s///;		# same as $a =~ s///;

If $a is a user defined object, then the same _as if_ rule would apply
and the object would mediate the operation.

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