2008-01-17

Deprecate Arrays?

Most (imperative) languages got some built-in support for array types and I was asking myself, if it wouldn't help us all to remove the special type from the language and instead treat them what they really are, to help us recognize them as that and get a better understanding of collections types?

What I want to say, would it make sense to replace

String[]
with
Map< Integer,String >
For clarity, the accessing of an array through the indexes could be viewed as a Dictionary=Map type usage, mapping an Integer to some other Type. To actively counter first no votes, you can also specify the initial size in the constructor type and I think optimization algorithms could deduce the original situation from the Map.

Of course some Generics/Template implementations right now are kind of verbose, but let's leave that detail out and assume some type inference.

No comments: