A simple solution for [] access that can trivially be added to List and Map.

Neal Gafter neal at gafter.com
Thu Jun 25 15:32:27 PDT 2009


On Thu, Jun 25, 2009 at 12:46 PM, Reinier
Zwitserloot<reinier at zwitserloot.com> wrote:
> Those additions are backwards and migration compatible, due to step 1,
> which legally allows both map and list's existing set/put methods to
> return something, even though in the SetIndex/SetWithKey interfaces,
> set/put return void. All existing class files that implement List and/
> or Map will seamlessly support the indexing operations, and any
> existing source code that implements Map or List or a child interface/
> class thereof continue to compile to the same semantic meaning without
> introducing any (new) errors and warnings.

Unfortunately, this strategy isn't binary compatible.  In order to
allow this new form of "covariant" returns, the compiler will need to
produce bridge methods in the implementation of every Map and List
class.  Existing class files simply don't contain those bridge methods
today.

-Neal



More information about the coin-dev mailing list