RFC 132: subroutines should be able to return an lvalue
[email protected] ("Syloke Soong") 18 Aug 2000 08:14:12 -0700
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | < "08E84399D52C4020*/c=US/admd= /prmd=National/o=notes/ou=Americas/s=Soong/g=Syloke/"@MHS> |
func(args) = ...
func(args) += ...
func(args) =~ s///
Such functions have been modeled in object models that accept
arg-list+operator (head+operator) polymorphic signatures. It would be
up to the programmer of func() to dictate what happens when func() is
invoked.
The following would be the pseudo-code (nothing to do with perl) that
simulates the operator as another argument.
overloadfunc...
func (operator:args){...}
func (+:args){...}
func (=:args){...}
func (+=:args){...}
func (=~:args){...}
func (args)
Which allows the following invocation:
a = func(args);
a = b + func(args);
a = func(args) + func(argt);
func(args) = a;
func(args) = func(argt) + func(argu);
However such an invocation is problematic:
func(argt) + func(argu) = anything else;
For such, I recommend that, for each LHS function create a thread. All LHS
threads would then have to cooperate to come to their individual resolution.
That would require multi-threading stability in Perl.
It is recommended to read the RFC in the perspective of object modeling in Perl.