On Wed, Jun 20, 2007 at 09:41:00PM -0400, Bob Rogers wrote: > From: Jonathan Worthington <[EMAIL PROTECTED]> > Date: Thu, 21 Jun 2007 00:05:00 +0100 > > Hi, > > Patrick R. Michaud wrote: > > My first question is "How do I add a class method?" -- i.e., > > a method that operates on a class instance as opposed > > to an object instance of that class . . . > > A method that operates on a class instance would be an instance method > of the class metaclass, wouldn't it? But I think you meant "on a > *particular* class [metaclass] instance", am I right?
Yes, I believe this is a better phrasing. If I want to define a new method or or override an existing method on a metaclass instance [a class], then how do I do that? The particular instance I'm looking at is a C<Str> class for Perl 6, where I want the get_string vtable function for the C<Str> metaclass instance is different from get_string of a C<Str> class object. At the moment perl6 is handling this (in PMC classes) by checking the identify of the invocant when get_string is executed and then responding appropriately. But I'm thinking it's likely that C<Str> will be implemented using pdd15 objects, so I'm looking for the "preferred approach" for doing things like this. Thanks, Pm