At 05:32 PM 20/04/2001 -0400, Dan Sugalski wrote:
>At 06:20 PM 4/20/2001 -0300, Filipe Brandenburger wrote:
>>Please tell me if there really is an use for overloading && and || that
>>would not be better done with source filtering, then I will (maybe)
>>reconsider my opinion.
>
>@foo = @bar && @baz;
>
> Dan
Well, Ok, that's an use for &&, but that's not the same use for && that
there is in
$foo = $bar && $baz;
That's because in the former (@foo), there's no pre-assigned behaviour to
&& with arrays in list context now, as there is with the latter, with $foo,
where there is a pre-assigned behaviour for && which only evaluates $baz
depending on the boolean context of $bar.
Also, on @foo = @bar && @baz, the && would depend on @bar (would be the
method in @bar's vtabler), right? The questions are:
If I issue @xyzzy = @bar, and I do @foo = @xyzzy && @baz, the `overloaded'
&& of @bar is copied to @xyzzy ? In this case, this goes the same place as
FETCH/STORE/... for tying an array. But then,
If I issue @xyzzy = (1, @bar), it wouldn't have how to copy the
`overloaded' behaviour of @bar, then I see some inconsistence here.
Well, the main point here is: It's probably worthless to discuss what goes
or doesn't go into vtables without knowing for sure how the language will
be and what will be its behaviour. That's why, in my first attempt to
explaining tying and overloading with vtables, I tried to be the most
conservative possible, considering only Perl 5 as a base for it. Since Perl
6 will be built as an evolution of Perl 5, the vtables model used on Perl 6
(the final one) will be possibly derived as an extension of this model, if
it's shown that it gives Perl 6 the extensibility features that are desired.
- Branden