Comment #11 on issue 34 by [email protected]: Repeated section should iterate
over dictionaries and have special variables $name and $value
http://code.google.com/p/json-template/issues/detail?id=34
I don't see what you're getting at in the last example -- you want to
iterate over
the values in the list typically, not the index. You seem to be spelling
it in 2
different ways. The index is always 0..n.
'repeated name obj' is like 'for name in obj', but 'repeated index list'
breaks down,
because you want to iterate over the items, not the indices.
Either way they don't read very well. If the intention was to have 'for
name in
obj', then we should spell it exactly like that. The language has no
variable
bindings now. Adding variable bindings for a minor feature isn't worth it.
Here is an alternative:
Lists have {...@index} and {...@value}.
objects have {...@name} and {...@value}.
{...@} just becomes a shortcut for {...@value}.
This lessens the fear for reserved names, because $index is a valid
variable name in
JavaScript, while @index is not.
At first I thought {...@index} looks ugly for some reason, but it's growing on
me.
{$index} looks a little more traditional. Also @foo means a vector in
Perl. But we
don't even have a Perl implementation.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---