From: Keats <ke...@ea...> - 2003-07-23 19:48:38
|
> (that's not the only option.) > > I think the [] notation works for everything but empty maps: > > #set $x = [ a => b, c => d ] > > or some other syntax ( [ (a, b) (c, d) ] ) > > As for empty maps, how about > #set $x = $Map.newEmptyMap() > > or the like? Does everything have to have a magic punctuation-based syntax? > Actually empty maps are more useful than empty lists, so I'd make [] be an empty map. I don't think there are many use cases for declaring a new Object[0] in a template. I don't really mind the curly braces, but I'm open. I kinda like the colons, but I'm not a stickler on this either. I actually prefer "=". Eric complains that it's not an assignment, but it is like an assignment. I.e., #set $map = ["A"=1, "B"=2] is the same as #set $map = [] #set $map.A=1 #set $map.B=2 It also connotes equality, as in: #if ($Map.A=1) ... Keats |