[Grace-core] collections interface for new classes

James Noble kjx at ecs.vuw.ac.nz
Fri Dec 11 20:26:21 PST 2015


so to make progress on collections - and varargs-or-not it seems my obvious options are: 

1. keep the API as it is, which implies keeping varargs 

2. drop varargs, adopt sequence literal constructors and use them instead.

3. ignore this issue, and do something else
       this is basically the same a option 1. above 




following up on 2, we do need to change the existing collection API. 
I see these options, at least: 

2.a   minimal change

> list.empty
> list.with [“a”, “b”, “c”] 
> list.with (anotherCollection) 

or generically
:
> list<String>.empty
> list<String>.with [“a”, “b”, “c”] 
> list<String>.with (anotherCollection) 

2.b factories are not generic but constructors are
(nongeneric code is same as 2a)

> list.empty<String>
> list.with<String> [“a”, “b”, “c”] 
> list.with<String> (anotherCollection) 


2.c just plain factories that are generic methods 

> list
> list [“a”, “b”, “c”] 
> list (anotherCollection) 
> 
> list<String>
> list<String>  [“a”, “b”, “c”] 
> list<String> (anotherCollection) 



J


More information about the Grace-core mailing list