[Grace-core] A curiosity of methods with variable arity parameter lists

James Noble kjx at ecs.vuw.ac.nz
Mon Aug 12 15:04:54 PDT 2013


> On the other hand, if you have with(), and want to write withAll(), then there is no way to do it without using reflection.  

Hmm. Some languages (Python?  Ruby? Scala?) have the "splat" operator that pastes in a collection as an argument list. Using that one could write something like:

 method withAll(items:Collection<Dynamic>) { self.with(*items) }

but there are other things (collection syntax? comprehensions?) that I'd steal first,
and the awful idea of "generalised requests" that keeps lurking in the background
(why can't we define "match/*case" or "if()/*elif*()/+else" nicely in Grace)

James


More information about the Grace-core mailing list