At 07:45 PM 8/9/00 +0000, Nick Ing-Simmons wrote:
>Peter Scott <[EMAIL PROTECTED]> writes:
> >At 06:23 PM 8/9/00 +0000, Nick Ing-Simmons wrote:
> >>While I remember - it would be good if overload mechansim
> >>could be extended to cover && and || as well as & and |
> >>with the class deciding if short-circuit happens.
> >
> >No.  I don't want to see && or || and not know whether it short-circuits
> >without looking in the class interface.  My brain is conditioned through
> >years of C and Perl to expect that they always short-circuit.  This is too
> >venerable a semantic to change.  Please.
>
>The reason I want the class to decide is not to change the semantic meaning
>but the implementation - i.e. _when_ it short circuits.

Hmm.

>I have an application which overloads all the ops and builds a little parse
>tree of objects. When you "look" at the tree it returns the value.
>
>my $a = new Thing;
>my $b = new Thing;
>
>my $cond = $a && $b;  # an object

Syntactic sugaring for something like

         my $cond = node ($a, '&&', $b);

right?

>I don't think giving overload control over short-circuit is any more
>surprising than allowing overloaded '+' to subtract.

True.  I guess you can't allow overloading of && || without the class 
getting to decide whether it short circuits anyway (well, not without a 
bizarre interface).
--
Peter Scott
Pacific Systems Design Technologies

Reply via email to