introspection (and Perl 6)
publiustemp-londonpm at yahoo.com
Mon Jan 21 17:43:26 GMT 2008
--- Aaron Trevena <aaron.trevena at gmail.com> wrote:
> On 21/01/2008, Jeff Anderson <captvanhalen at gmail.com> wrote:
> > $class.^can('foo')
> > That syntax is nearly as elegant as mud is not. :P
> Yes - what's wrong with just having a can method, it's say not ^say,
> so why the silly hat?
> And yes, I am bitching about perl 6, mostly because I'm starting to
> write code in it and some of the syntax changes like this are just
I think the problem here is that when you universally shove things into
all objects, you force your changes on everyone.
That's actually shorthand for:
You can still do this:
But if another programmer needs to override can() in a subclass, you
can still allow easily reach the original can() method, if needed.
This method is properly kept in a metaobject (fetched, of course, with
$class.HOW) which is separate from the class itself. It's a good step
towards metaprogramming, but since 'can' isn't entirely honest, it
seems broken to me.
Since not many people get into metaprogramming, however, it might not
have much effect.
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/
More information about the london.pm