introspection (and Perl 6)

Jeff Anderson captvanhalen at gmail.com
Mon Jan 21 19:44:34 GMT 2008


Nice! Now i can protest peacefully with Perl!

$bush.HOW.can('you');

$blair.HOW.can('you');

etc. ;)

On Jan 21, 2008 12:43 PM, Ovid <publiustemp-londonpm at yahoo.com> wrote:
> --- 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
> > WTF.
>
> I think the problem here is that when you universally shove things into
> all objects, you force your changes on everyone.
>
>   $class.^can('foo');
>
> That's actually shorthand for:
>
>   $class.HOW.can('foo');
>
> You can still do this:
>
>   $class.can('foo');
>
> 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.
>
>
> Cheers,
> Ovid
>
> --
> 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/
>



-- 
jeffa


More information about the london.pm mailing list