On Tue, 2009-12-08 at 18:58 -0500, Austin Hastings wrote: > I know that I could 'metaprogram' this stuff by using string > manipulation on the various method names, and then calling a > (self-built) call_method($obj, $method_name, ...args...) function.
You don't need to write this by hand. NQP-rx supports the method call by name Perl 6 syntax: $obj."$method_name"(...args...); which makes this kind of thing much easier. I use it in Plumage in a number of places. > But I'm curious if there's some P6 feature I've forgotten about (which > I've forgotten most of them, excepting the rev number) that would let me > do this without having to go too far away from the metal. The above syntax is actually pretty close to the metal because it translates directly to standard PIR ops. -'f