On Wed, Nov 12, 2008 at 12:06 PM, Charles Oliver Nutter <charles.nutter / sun.com> wrote: > I'm leaning toward a wholly array-based structure that specifies all > this but is future-proof... a couple examples > > def foo(a, b = 1, *c, d) > => [[:req, :a], [:opt, :b, 1], [:rest, :c], [:req, :d]] > > def foo(a, (b, c)) > => [[:req, :a], [[:req, :a], [:req, :b]]] > > And hypothetical keyword args, identified like symbols... > > def foo(a, :b, :c) > => [[:req, :a], [:key, :b], [:key, :c]] > > I think just about all combinations of args can be specified this way, > and since the structure is really fluid I'm not sure any concrete > class could represent all possible structures. > > This also leans back toward Yehuda's original goal of a simple > array-based structure without sacrificing the ability to express all > combinations of args now and into the future. Going back to the examples I had before: foo(a, b = 2, *c, &block) => [[:req, :a], [:req, :b, 2], [:rest, :c], [:block, :block]] foo(a, *, c) => [[:req, :a], [:rest, nil], [:req, :c]] foo(a, b, c = b) => [[:req, a], [:req, b], [:opt, :c, :expr]] I can see that, perhaps -- although I don't see what it gives us over an array of hash values (except perhaps being lighter weight because of the lack of names in the listed items). -austin -- Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/ * austin / halostatue.ca * http://www.halostatue.ca/feed/ * austin / zieglers.ca