[E-Lang] An Attempted Restatement of Hydro's Semantics

Dean Tribble tribble@e-dean.com
Mon, 02 Apr 2001 11:06:31 -0700


4/2/01 2:27:21 AM, "Mark S. Miller" <markm@caplet.com> wrote:

>At 06:10 AM Monday 4/2/01, Tyler Close wrote:
>>As Dean has already pointed out, the only reason to provide an indexable list is to make iteration using C style for(;;) loops possible. For example,

I did not assert the above, but I provided some  information that might be considered to support it.  The backwards compatibility reasons for indexable lists is certainly important to consider.

>>
>>    for(int i = 0; i != v.length; ++i)
>>        System.out.println(v[i]);
>
>I must have missed it.  Could you send a URL or quote the argument?  Dean, 
>care to restate?  I find this stance surprising.

It was not a stance, merely an observation.  Most (as in almost all!) of the occurrences of [] access syntax in Java code that I sampled (which included elib and my own, so not a broad sample) were in the context 
of iterating a collection.  Most of the []= was in the context of doing a Smalltalk:collect: operation (make a new collection by applying the following function to all elements in an initial collection).

The only occurrences that I noticed otherwise were when Array were used inappropriately as data-structures, and in the occasional special handling of the first element of a Vector.

Try grepping some representative piece of code sometime.  I used something like 'grep "\[" `find . -name "*java"` | grep -v "new\s*\w*\s*\[" | grep -v "\[\w*\][^ \t=]*{" to get all lines with [ in them that were not 
obviously an array initilaization or array allocation (in thae above, \s is whitespace and \w is alphannumeric).

Though I posed the hypothesis, I was rather surprised at the extent to which it seemed true.  Let me finish by saying that I did not actually make the claim that