[E-Lang] An Attempted Restatement of Hydro's Semantics
Mark S. Miller
markm@caplet.com
Mon, 02 Apr 2001 08:27:21 -0700
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,
>
> 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.
>In 2 years of programming with Hydro, I have never felt the need for a C-style indexed array (the DynamicArray that was in Hydro v1 never got used). I don't have any code that actually does the above operation.
I find this surprising as well. However, you've been programming in Java
while using Hydro. Ever use a Java array? Ever index into it?
>It is also worth pointing out that providing an indexed interface would be misleading. Programmers accustomed to arrays do not expect collection elements to jump around to different positions. As you know, the elements in a hashtable do jump around on element removal.
Depends on how you implement it. I would only do this if the order was the
intuitive FIFO one.
>Initializer is meant to be used as a collection initializer (ie: constructing the collection abstractions: queue, map, set, sorted map, sorted set) and as a "tuple". Wherever E uses the square brackets, I expect that to be a call to Initializer.Maker.
That reminds me. I forgot to list "tuple" among the various names for
list-like data in various programming languages.
>I don't think indexing is useful, but if you really want it, then I would be willing to add it to the Initializer interface.
Once we do that, what would I need Queue for?
>The only reason its not there is because you don't need it. If you want it anyways, then I think the best place is on the Initializer interface.
Cool. If Initializer becomes our list type, we should give it another name.
>>An indexable list is one of the first tools a programmer will reach for. It
>>must be there. We'll already surprise them enough when they find out it
>>must be immutable.
>
>I know MarcS has said this before too, but he's never shown a plausible example. E's for loop really obviates the need for index operations.
I'm talking about surprise, and it sounds like MarcS was too. Are you
saying that MarcS failed to produce a plausible example of surprise or of
need? They're different.
Cheers,
--MarkM