[Grace-core] minor language issues

James Noble kjx at ecs.vuw.ac.nz
Sun May 24 19:34:25 PDT 2015


varargs vs collection-passing:

> You'd need a strong motivation to get rid of them.

well I always have dreams about getting rid of stuff (so I can put in MORE OTHER STUFF)

> Hitherto there has been opposition to collection literals, so that approach was
> impractical, and it's less pleasant to work with anyway.

If there weren’t objections to collection literals, what do you see are the other disadvantages vs varargs? 

Andrew wrote: 

> Variable arity methods also make the syntax seen by the requester more uniform.  The requestor writes set.with(4, 5, 6), list.with(4, 5, 6) and sequence.with(4, 5, 6) rather than set.with[4, 5, 6], list.with[4, 5, 6] and [4, 5, 6].  

sure, although really I guess nonuniformity is 

[4, 5, 6]         // built in sequence
list.with [4, 5, 6]   // list 
set.with  [4, 5,  6]   // set…  

or with factory methods / non-dotted classes: 

[4, 5, 6]         // built in sequence
list [4, 5, 6]   // list 
set [4, 5,  6]   // set…  

or with one sort of magic:

collect [4, 5, 6]
collect [([4, 5, 6 ])] 
collect [{[ 4, 5, 6 ]}] 

or another sort of magic

[4, 5, 6]
[([ 4, 5, 6 ])] 
[{[ 4, 5, 6 ]}] 

which do we prefer? 

J 




More information about the Grace-core mailing list