On Fri, Jul 11, 2008 at 03:27:26PM +0200, TSa wrote: > HaloO, > > Patrick R. Michaud wrote: >> S29 doesn't show a 'sort' method defined on block/closure >> invocants... should there be? > > I doubt that. And to my eyes it looks funny. Only real block > methods should be useful and since the class is mostly known > at parse time unapplicable methods should be a compile error. > > my &f = { $^a <=> $^b }.assuming($^a = 3); > > say f(3); # prints 0 > > Would that be valid? I mean the usuage of automatic variables > in the assuming method?
No, that could not work, because $^a = 3 would be in an rvalue context and refer to the block around the entire statement as a different parameter. Setting a named parameter with .assuming must use named argument notation: my &f = { $^a <=> $^b }.assuming(:a(3)); Also, it may well be that f(3) will say Order::Same rather than 0. :) Larry