[jifty-devel] RFC: Improved Template::Declare Wrappers

David E. Wheeler david at kineticode.com
Thu Dec 10 12:50:45 EST 2009


On Dec 10, 2009, at 7:55 AM, Shawn M Moore wrote:

> Okay so I think it's already been decided that we don't need to name
> wrappers. Good.
> 
> I think we can get away with not allowing subpaths for wrappers.
> Presumably you would use such a thing when you want to wrap only a
> subset of the templates in the package. But then why not just make a new
> package and use mix/alias?

Because templates don't have that requirement.

> So, if we have nameless wrappers that always apply to '/' (or rather, '.'),
> we can have shiny syntax:
> 
>    wrapper {
>        my ($self, @args) = @_;
>        html {
>            body {
>                inner(@args); # or maybe just "inner;" a la Moose
>            }
>        }
>    };

Yes, agreed, that's nice. We could certainly start with that, and then perhaps support paths with a different keyword, something like:

    under '/foo' put wrapper { ... }

That allows us to keep the clean syntax.

> Another option is to specify wrappers in calls to "mix" and "alias". I
> don't know if there's a good use case for this.

Cool idea, but I think that's starting to overload alias too much. I don't see a use case for it, so I don't really see a need for it. No need to add something no one has asked for, eh?

Best,

David


More information about the jifty-devel mailing list