List Info

Thread: TT3 Virtual Objects




TT3 Virtual Objects
user name
2006-02-02 19:39:48
> _Hash   #  ->  _Hash.new(a => 'A')
> _List
> _Text

Or - what if there was an "accumulator" that could
be used for generic access 
to anything that the TT engine wants to supply and not let
the templates 
override.

For that I'd propose '_'.

_.Hash  # > _.Hash.new.

Or maybe having the . isn't necessary - actually I'd prefer
for it not to be 
there.

So I'd still like _ to be there, just more general purpose -
as in:

my $t = Template3->new(virtual_objects => {
  Hash      => &MyHashInstantiator,
  MyType => 'MyPackageFoo',
});

and in the templates

[% foo | _Hash.somecoolthing %]

[% _MyType.new.do_something() %]

This feels more general to me.  It should still be
unambiguous with the '_' 
operator - but I'd almost argue that the '_' concatenation
operator should go 
and just leave '~' for concatenation.

Paul

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )