"Syloke Soong" <[EMAIL PROTECTED]> writes:
> 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.
For these simple cases you can use overloaded operators and
polymorphic signatures. But there is no solution for the
for (func(args)) {
... something weird (but legal Perl) involving $_ ...
}
sysread($fh,func(args),...)
$ref = \func(args)
> 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)
The requires a zillion overloads (for every operator, =operator, all
data types)!
The important thing about the lreturn (or whatever it is going to be
called) is that it is orthogonal to everything else, and hence need no
extensive special-casing as with the overloads.
> However such an invocation is problematic:
> func(argt) + func(argu) = anything else;
This isn't legal (it isn't legal for normal variables also).
-- Johan