On Tue, Aug 09, 2005 at 06:32:52PM -0400, Stevan Little wrote: > Now I realize that in perl 6 you can re-open classes and add methods to > them. However this is not convenient for programmatic class generation.
Because of string eval, you mean? Well, some quasiquoting should fix that, but let's suppose Template Perl6 doesn't exist... :-) > And I would really prefer the old Perl 5 way of mucking with the symbol > table not be the Perl 6 way of doing this. The ideal approach IMO is to > be able to do what the p5 MetaModel prototype does, and be able to add > methods to the metaclass instance directly (which then exposes them to > the class and instances of the class). > > So, how should this look in Perl 6? I currently have a two > thoughts/suggestions/directions. > > 1) Anonymous methods/submethods > $obj.meta.add_method('foo' => method (Foo $self: $bar) { ... }); # > adding an instance method I think it was ruled a while ago that anonymous methods should exist, so this form is certainly more preferred. Thanks, /Autrijus/
pgpO1YipjPRcV.pgp
Description: PGP signature