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

David E. Wheeler david at kineticode.com
Wed Oct 7 14:24:25 EDT 2009


On Oct 6, 2009, at 10:05 PM, David E. Wheeler wrote:

>> In imported templates, the invocant is an object blessed into the
>> class into which the templates were imported.
>>
>> In aliased templates, the invocant is an object blessed into the  
>> class
>> from which the templates were aliased.
>
> Turns out that in neither case is an object passed. It looks like an
> object is *never* passed. It's a class name. This, to me, makes the
> distinction even less important.

It turns out that I was wrong to start with. The truth is that the  
invocant is always the class from which the template was imported/ 
aliased. The only subtlety is when mixing in or aliasing a subclass of  
templates:

* When importing a subclass of templates, the invocant is always the  
class in which each template was defined.

* When aliasing a subclass of templates, the invocant is always the  
subclass, regardless of whether a particular template was defined in  
the subclass or a parent.

This is a pretty minor difference, but I've updated the tests in the  
mixmaster branch to confirm this (the tests were ambiguous before). Is  
there any reason for this inconsistency, does any code rely on it, or  
was it just an oversight of the implementation?

Best,

David


More information about the jifty-devel mailing list