[Prev][Next][Index][Thread]

Re: zero? & 0 | 1



On Mon, Mar 13, 2000 12:11 Uhr, Tim Bradshaw <mailto:tfb@cley.com> wrote:
>* Gabor Greif wrote:
>> The reasoning is that binary operators are evaluated from left to right
and
>> &, | only evaluate their rhs if necessary.
>
>I don't think this has to follow.  I don't know dylan that well (and
>I've no implementation to hand to try this on), but, for instance,
>what does 1 + 2 * 3 evaluate to?  My guess is 7, not 9.  So
>bool-value? & 0 | 1 could easily be (bool-value? & (0 | 1)).
>
>--tim
>

Thanks for the critique, I should have added that DRM defines | & and := as
having same precedence and lower than any other (binary) operator.

This is probably why the Dylan folks did not cry out loud :-)

Also everything ~== #f on the lhs of & triggers eval of its rhs.

Now the reasoning should infer the identity of

bool-value? & 0 | 1

with

(bool-value? & 0) | 1

	Gabor