Comment #4 on issue 34 by tim.schaub: 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'm also curious what value the cursor assumes when iterating over elements in an array in your proposal. It seems to me like the pattern is the same for objects and arrays. People commonly iterate over members in an object and elements in an array. In both cases, within the repeat block, you need two references. For objects, you need a reference to the member name and the member value. For arrays, you need a reference to the element index and the element value. Sometimes, you don't need a reference to the index for an array. And perhaps sometimes someone might not want a reference to the member name in an object (though I wouldn't suggest this is very common). You've already got the cursor (@). It makes sense to me that this would become the one thing people always need when iterating: member value for objects and element value for array. That leaves one variable name that needs to be determined. You suggest reserving names for it in the language ($index and $name). I'm suggesting letting the template designer pick the name - and taking advantage of the second term you already require in your .repeated directive. I have no idea how many adopters there already are for json-template. And I don't mean to neglect the importance of backwards compatibility. If, however, the language is still young, it would be unfortunate if it became unnecessarily awkward for the sake of preserving backwards compatibility when that might not really be an issue (also, version numbers are cheap). -- 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 -~----------~----~----~----~------~----~------~--~---
