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

Shawn M Moore sartak at bestpractical.com
Tue Oct 13 17:06:40 EDT 2009


On Tue, Oct 13, 2009 at 01:37:12PM -0700, David E. Wheeler wrote:
> On Oct 13, 2009, at 11:36 AM, Shawn M Moore wrote:
> 
> > I just want to point out that this is an important use case for us. We
> > do use the object-oriented features of Template::Declare and it is
> > important that they continue to work.
> 
> Thanks Shawn. Based on your testing results, I changed things around.  
> The behavior of `alias` is now as it was before, and  
> `import_templates` is different.

Aye, cool. :)

> > As I understand it, you have since fixed this, but I felt you  
> > deserved a
> > good explanation as to why we pass in the particular class we do.
> 
> Yes, I appreciate it.
> 
> Before we decided to merge this stuff into trunk there were two things  
> I wanted to get nailed down:
> 
> * Improved documentation for this stuff. I'm now working on this and  
> should commit it later today.

Yay!

> * Discuss if the `alias` behavior really *is* what we want. I ask  
> because, in a real mixin system, the invocant passed to a mixed-in  
> method would be an object of the class into which it's mixed, not the  
> class from which it's mixed. Based on your comments here, I think that  
> the answer is yes, but I did want to reality-check it. Sound about  
> right?

Perhaps mixin is the wrong metaphor for alias. I think delegation is a
better metaphor, since we really need the original class passed to the
aliased templates. See also
http://search.cpan.org/~drolsky/Moose-0.92/lib/Moose/Manual/Delegation.pod
for a definition of delegation and why it's good.

There's a place for the mixin metaphor, maybe that can be "import", or
something new.

> Thanks,
> 
> David

Shawn



More information about the jifty-devel mailing list