Eryq wrote:
>
> I'm weary of proposals like "lets add/extend named operator X".
> Perl needs *fewer* special cases, not *more*. I want the
> following pairs to ALWAYS be identical, and ALWAYS mean
> method invocation:
>
> open THING ARG,...,ARG
> THING->open(ARG,...,ARG)
>
> print THING ARG,...,ARG
> THING->print(ARG,...,ARG)
Yes, exactly. 100%. A "handler" is a pseudoclass, but it's still just a
class. Try out my Perl 5 prototype at:
http://www.perl.com/CPAN/authors/id/N/NW/NWIGER/Class-Handler-1.03.tar.gz
> And I want the *absence* of an indirect object to have
> the well-defined meaning that we are *calling a function*:
>
> print ARGS... # function call of CORE::print()
> print $OUT ARGS... # method invocation
> $OUT->print(ARGS...) # method invocation
I agree with you on this, actually, but I would like the indirect object
to be a little more flexible (hash and array elements, for example).
> Implementation of CORE::print() then reduces to:
>
> sub CORE::print { $CORE::DEFOUT->print(@_); }
Actually, it would be more like:
sub CORE::print { $main::DEFOUT->print(@_); }
Since special variables live in $main::, but yes, I agree
wholeheartedly.
-Nate