Boost logo

Boost :

From: Juan Carlos Arevalo-Baeza (jcab.lists_at_[hidden])
Date: 2002-10-13 02:21:33


On Sun, 13 Oct 2002 10:48:12 +0800, Joel de Guzman wrote:

>r = r | a; // left recursion
>
>will be different from
>
>r |= a; // previous_definition_of_r | a;
>
>Which will surely be a source of confusion.
>
>Also, further down the road, since Spirit also supports
>
>a | b... union (alternative)
>a - b... difference
>a & b... intersection
>a ^ b... exclusive or
>
>Then supporting |= will also mean supporting -=, &= and ^=. Now let's see...
>
>r = r | a;
>r = r - b;
>r = r & b;
>r = r ^ b;
>
>All the cases above are left recursive.
>
>In conclusion, I think what should be done instead is to focus on
>a way to solve the r.alias() nuisance.

   Actually, I'm afraid I have to vote to use the |= and the others anyway (and >>=, now that I think of it). Yes, it changes the meaning of the expression _slightly_ from r = r | a, but it changes it from one that is clearly an error (left recursion) to one that approximates the original meaning without the error.

   And the result is pretty reasonable. IMHO. After all, it also happens to mimic the _normal_ behaviour of assignment operators: x = x + 1 _really_ means x = previous_definition_of_x + 1, which is a concept that everybody working with C++ understands just fine...

   Salutaciones,
                    JCAB
email: jcab_at_[hidden]
ICQ: 10913692 @WORK: 101728263
WWW: http://www.JCABs-Rumblings.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk