[jifty-devel] Difference Between alias and import_templates in Template::Declare

David E. Wheeler david at kineticode.com
Wed Oct 14 21:47:59 EDT 2009


On Oct 14, 2009, at 12:48 PM, Shawn M Moore wrote:

>> delegate '/foo' in This::Class to  Some::Class setting {};
>
> This would be confusing. I'd think it was taking the /foo template in
> This::Class and putting it into Some::Class.

Thanks to this discussion and some chatter on IRC, I realized that the  
old `import_templates` interface was the mixin interface, and the  
`alias` method was the delegation interface.

So now I've un-deprecated `alias` and will document it as the  
delegation interface. And I've changed `mix` and the still-deprecated  
`import_templates` so that they now have the class into which they are  
imported be the invocant.

So what this means, in the end, is that the code is now different from  
when I started in the following ways:

* `alias` now creates much more efficient aliases, and supports an  
`into` parameter
* `mix` is the new name for `import_templates` and also supports an  
`into` parameter
* `mix` and `alias` can now both be called with package variables  
assigned, optionally via the `setting` keyword.
* `import_templates` is deprecated but works the same as always.

In short, I've added some new features, simplified the code, but have  
not broken compatibility in any way that I know of.

Best,

David


More information about the jifty-devel mailing list