[Grace-core] Collection naming

James Noble kjx at ecs.vuw.ac.nz
Mon Jun 30 06:40:24 PDT 2014


> each of the collections (sets, lists, dictionaries) 

Give the message title "Collection naming"
I thought I should bring to mind the issue of immutable (persistent) vs mutable collections.
before we start baking names into the next generation code 
(i.e. before anyone other than andrew starts using his collections seriously) 

Do we (in principle) want both implementations?  
Which should be principle?   Is it non-OO to make immutable versions? 
How do we want to distinguish mutable from immutable?   (functional from OO)? 

immutable         mutable 

seq(uence)         list  (or vector) 
map                   table (or dictionary)
set                     bunch? / batch? / group? / many?    (as in     class Course {  def students = many<Student>;  } 
(bag?                  tally? / histogram?) 
string                 packedArrayOfChar

vector?  matrix? ...    stack? queue?  deq?   (and what about the immutable versions of those, or just sequence?) 

How about APIs?  How do they work?  How do we choose?
 - mutable has all immutable operations (but they work very slowly) 
 - mutator operations have names   (addAll; removeAll; remove; etc
 - "persistent" aka immutable operations are symbolic   + (or ++);  - (or --);  Scala uses += -= for add element, remove element
 - (or vice versa) 
 -  ∩ ∪ ⊂⊃  ∋  (but not ∈)  ⦰   (and no, I can't type 'em)  
 - what should == do on mutable collections?   on immutable collections?  
     (python has a nice solution: only immutable objects are hashable) 
 - do we have "IdentityCollections" too?   WeakCollections... 
 - how should different kinds of collections interact?
     - mut vs immutable  (but basically same type)
     - different types (both mut or immut;  different mutabilities)
 - is a map/table/dictionary a collection?  If so, how?   are they ordered? should they be? 
 - slices? 

(how about streams?    infinite streams?  size method?) 

J

and on it goes...
- http://wiki.squeak.org/squeak/uploads/SqueakClassesRef.html
- what other languages should we look at as references: Ruby/ Python/ Scala/ Ceylon/ Swift?  (Go?) 


More information about the Grace-core mailing list