[jifty-devel] Playing with the class loader

Andrew Hanenkamp sterling at hanenkamp.com
Wed Feb 27 10:31:34 EST 2008


On 2/26/08, Chia-liang Kao <clkao at bestpractical.com> wrote:
>
> This is quite neat.  I only skimmed the module a bit.  any reason the
> ::declare modules isn't using object::declare?


I didn't use it because it didn't provide any initial benefits for the
syntax I chose. It was actually modeled more after Jifty::Dispatcher than
Template::Declare. That isn't to say I couldn't add support for it.

A bit related to this particular abstraction, I was thinking the
> classloader should mostly only inject 'use base' and some very short subs:
>
>    requiring 'Some::**::Class' => generates { qq{
>        sub print_my_middle_names { print $1,"\n" }
>    } };
>
> can be:
>
>    requiring 'Some::**::Class' =>
>      base is 'YourBase',
>      method print_my_middle_name => sub { ... },
>      more_code is { qq{sub still_able_to_declare() { } } };



This also avoids string evals and gets us more compile time check.



I like this syntax in some ways. The more_code section has the potential of
eliminating the need for the declare { ... } block. You are right that it
provides the recommendation for stronger compile time checking.

If I switch to this syntax, then I would certainly be using Object::Declare.

I hope to give this another look in the next few days. Thanks.


should really be
>
>
> > I got back around to playing with this and wanted to post this to the
> > list for others to try out before I made any commits. This has the
> > opportunity to be a fairly horrendous breakage of Jifty if I've screwed
> > it up. It passes tests for me on the latest trunk.
> >
> > Attached you should find a patch that will convert the existing
> > Jifty::ClassLoader to use Class::AutoGenerate, which provides a
> > declarative DSL for code generation that is somewhat similar to
> > Template::Declare. It requires Class::AutoGenerate 0.05 which was only
> > recently uploaded to CPAN, but you can fetch from the PAUSE server or
> > directly from Subversion:
> >
> > http://svn.contentment.org/svn/trunk/Class-AutoGenerate
> >
> > Cheers,
> > Andrew
> >
> >
>
> > ------------------------------------------------------------------------
>
> >
> > _______________________________________________
> > jifty-devel mailing list
> > jifty-devel at lists.jifty.org
> > http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jifty.org/pipermail/jifty-devel/attachments/20080227/3ad0e0cd/attachment.htm 


More information about the jifty-devel mailing list