Proposal: Indexing access syntax for Lists and Maps

Mark Thornton mthornton at optrak.co.uk
Tue Mar 31 00:47:04 PDT 2009


Stephen Colebourne wrote:
> I'm surprised annotation solutions are being considered given the 
> general approach taken to annotations affecting the language.
>
> For this feature, if it went ahead, I would strongly request having four 
> new interfaces
>
> IndexedGet
> IndexedSet
> MappedGet
> MappedPut
>
> Each with one method.
>   
There are two disadvantages to this approach:

1. The type of the index is restricted, presumably to int. This would 
prevent this mechanism being used to provide huge 'arrays' with long 
indexes. If regular arrays are subsequently extended to support long 
indexes this would then be a mismatch.
2. Can't readily be extended to higher dimensions should that later be 
considered desireable.

Mark Thornton




More information about the coin-dev mailing list