From: Daniel Brockman Date: 2005-07-01T04:20:06+09:00 Subject: Re: iterators and block arguments Eric Mahurin writes: > Daniel Brockman wrote: > >> Maybe this syntax could be adopted? >> >> def foo a, b, *args, c, d; ... end > > I want that too. It would be nice for the []= method > where the value is always the last argument. Yeah, that's a good example. Does anyone have another? > Or any method where you want optional arguments first or > in the middle. > > In general, this: > > def foo a, b, c=x, d=y, *other, e, f > ... > end > > should be equivalent to: > > def foo a, b, *remaining > e,f = remaining.slice!(-2,2) > c = remaining.empty? ? x : remaining.shift > d = remaining.empty? ? y : remaining.shift > other = remaining > ... > end > > Want to submit an RCR for this? I've already done my fair share. Fair enough. I'll wait a few days to see what happens to this thread, and then I'll probably submit one. -- Daniel Brockman