List Info

Thread: TT3 Virtual Objects




TT3 Virtual Objects
user name
2006-02-02 19:21:21
Continuing on the last email of making reserved words less
reserved, TT3 is 
adding (I assume) Hash List and Text to the list to allow
for Virtual Object 
access (although this may just be proposed).

I'd like to request that the Virtual Objects instead get
accessed using a name 
that doesn't have potential conflicts with other items in
the stash.

One mechanism for doing this would be to use underscores as
they are already 
not available in variable names.

Some possible iterations:

_Hash   #  ->  _Hash.new(a => 'A')
_List
_Text

Or maybe Pythonish

__Hash__   # -> __Hash__.new(a => 'A')
__List__
__Text__

I'd probably prefer the first.  I think that it is a small
price to pay for 
keeping variable access sane vs reserving more words.

I'd love to hear any feedback.

Paul

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
TT3 Virtual Objects
user name
2006-02-02 19:59:35
mailseamons.com wrote:
> I'd like to request that the Virtual Objects instead
get accessed using 
> a name that doesn't have potential conflicts with other
items in the stash.

You'll be able to call them what you like through the usual
plugin interface.

  [% USE Hash %]
  [% h = Hash.new(a=10) %]

  [% USE Roger=Hash %]
  [% h = Roger.new(a=10) %]

Or you can access them via the default 'hash:' namespace or
to a namespace
of your choosing.  This sidesteps the whole variable
namespace altogether.

  [% hash = hash:new(a=10) %]   

In this example, the first 'hash' is a variable, the second
'hash:' is a 
namespace, and the 'new' is an item within the 'hash:'
namespace, totally 
separate from any variables that may be called 'hash', 'new'
or anything 
else.

Cheers
A


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

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