A simple solution for [] access that can trivially be added to List and Map.
Lawrence Kesteloot
lk at teamten.com
Thu Jun 25 15:35:03 PDT 2009
Reinier wrote:
> We're still talking about, as Ruslan showed, a
> vanishingly small number of code-lines where pass-through assignment
> is even an issue.
Ruslan only checked compound assignment (a = b = c). What about my
idiomatic assignment-in-while:
do {
x = read();
} while ((list[i++] = x) != terminatingValue);
or, more concisely:
while ((list[i++] = read()) != terminatingValue) { ... }
I used to see this all the time in C, but haven't seen it much in Java.
I like your proposal. Compared to Neal's static import, however, it
seems more invasive (void-return change) and less flexible (the
assignment can't decide what to return). The void-return change, in
particular, smells bad.
Lawrence
More information about the coin-dev
mailing list