Readable Java 1.5
Subject:   Re: eachof
Date:   2003-09-28 09:58:29
From:   sjungels
Response to: eachof

Thanks for responding. I assume you mean that you find Sun's "for :" syntax quite readable, not my "eachof" syntax. You make an interesting point, but I suspect type theory is too esoteric as a basis for the syntax in a language for the masses such as Java.

Programmer's are more likely to have seen the ":" used in basic set theory, for example,

S = { x : 0 < x <= 1},

where ":" is pronounced "such that." This could have been the basis for a nice collections iterator, for example

for (String x : x elementof C)

where C is a collection. But the Java 1.5 proposal doesn't do it that way, and the colon character by itself is still cryptic, as I argued in the article.

The issues you raise in the second paragraph apply only to the extended version of "eachof" which I should have more clearly stated was a "bonus." A simple eachof designed as a drop-in replacement for the "for :" syntax would not raise any semantic issues different than "for :".

Thanks for an interesting post.

1 to 1 of 1
1 to 1 of 1