PROPOSAL: Unsigned Integer Widening Operator (original) (raw)
Stephen Colebourne scolebourne at joda.org
Wed Mar 25 16:19:42 PDT 2009
- Previous message: PROPOSAL: Unsigned Integer Widening Operator
- Next message: PRE-PROPOSAL: Simple operator overloading.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: PROPOSAL: Unsigned Integer Widening Operator
- Next message: PRE-PROPOSAL: Simple operator overloading.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]