PROPOSAL: Unsigned Integer Widening Operator

Stephen Colebourne scolebourne at joda.org
Wed Mar 25 16:19:42 PDT 2009


Bruce Chapman wrote:
> Unsigned Integer Widening Operator
> 
>             for(int i = idx; i < idx + length; i++) {
>                 value = (value << 8) | (+)buffer[i];
>             }

While I think this is neat, I see how an API handles the case reasonably 
well too.

This syntax also removes one option for operator overloading in Java:

DateTime dt = ...
dt = dt (+) days(3);
   // which is actually dt.plus(days(3));
}

if (a (==) b) {
   // which is actually a null-safe .equals() comparison
}

(not that I am pushing for either of these right now, but this syntax 
does block this potential alternate usage for (+).

Stephen



More information about the coin-dev mailing list