Re: RFC 174 (v1) Parse C<func($obj, @args)> as C<func $obj (@args)>
[email protected] (Tom Christiansen) Wed, 30 Aug 2000 16:33:07 -0600
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <27462.967674787@chthon> |
> > Just wanted to clarify this, as I think this may be the part that
> > overlaps with what you're doing. Under this syntax, the object would be
> > called for you automatically, so your prototypes wouldn't have to deal
> > with optional first arguments at all:
> >
> > print($FILE, "$stuff"); # $FILE->print($stuff)
> > print("$stuff"); # main::print($stuff)
>How does it know that the second version isn't:
> $stuff->print();
[coming in on the middle of this, so context may be muddled]
But for the double quotes, it wouldn't. But double quotes are
going to trigger a stringification, which in most worlds produces
something that isn't overloaded. I presume it invokes SCALAR->print
or STRING->print or something.
$stuff->as_string->print()
Of course, the q/""/ overload for whatever class $stuff is actually
*could* return something that were itself overloaded, at which point
you'd presumably run through all that again. But eventually this
would have to end if you expect your program to advance. :-)
--tom