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

Jesse Vincent jesse at bestpractical.com
Mon Dec 7 12:54:26 EST 2009




On Tue, Dec 01, 2009 at 12:30:45PM -0800, David E. Wheeler wrote:
> On Dec 1, 2009, at 12:16 PM, Jesse Vincent wrote:
> 
> > I don't have a good answer for that, short of "declaration order" or
> > some similar insanity. Your argument was pushing me toward "no names"
> > rather than "multiple per package and level"
> 
> Me too.
> 
> >> I don't care if they have names, frankly. So maybe the syntax could just be:
> >> 
> >>    wrapper '/' => sub { };
> > 
> > I wonder if making it imperative makes sense? wrap instead of wrapper.
> > 
> >    wrap '/' => sub { };
> 
> Well, none of the other keywords are imperative. It's `template`, not `create_template`. Similarly for language keywords for declaring things (`sub`, `method`, `class`, etc.).

I guess my thought process was that none of the other keywords actually
are imperative - they don't apply action at a distance.

> 
> > When we're doing template resolution, "/" still means at the root, not "the
> > current package", right?
> 
> Correct.
> 
> > That would lead me to want to use relative
> > pathing syntax here.  '.' or './' or _something_, since '/' means something 
> > fairly specific already.
> 
> That would be allowable, yes.
> 
> > Really, when we start specifying paths and subpaths, for these wrappers
> > to wrap, I start reaching for a path based dispatcher with globbing
> > and/or regexes, ala Path::Dispatcher or Jifty::Dispatcher, but I know
> > that's not the hammer you're looking for. Maybe we really do just want
> > one wrapper per package scope.
> 
> Things don't resolve that way, really. Templates already resolve to paths; so should wrappers.

*grumble* Given that, I think we should prohibit wrappers from wrapping
things outside the namespace they contain. IE, absolute "/" would be either
be defined as the root of the current package OR it would be forbidden.

-j


More information about the jifty-devel mailing list