From: Eric B. R. <eb...@tc...> - 2003-05-13 20:07:08
|
On Tuesday, May 13, 2003, at 03:42 PM, Keats wrote: > Eric, > > This is way cool! Personally I'd vote for colons, but I can live with > the > "=>" if there is some advantage to this. Colons works for me too. => is kinda tricky to type. I'll try to change it tonight. eric > You rock. > > Keats > ----- Original Message ----- > From: "Eric B.Ridge" <eb...@tc...> > To: "Keats" <ke...@ea...>; > <web...@li...> > Sent: Tuesday, May 13, 2003 1:34 AM > Subject: Map Support (was: Re: [Webmacro-devel] #templet directive) > > >> <snip> >>> A built-in Map declaration syntax would help here. E.g., >> <snip> >>> Since I don't see this coming anytime soon, how about a $map >>> function: >> >> Disclaimer: I only spent an hour and 15 minutes on this... >> >> I've just committed some highly experimental Map support into CVS. >> >> #set $map = { "key" => "value", "foo" => "bar" } >> $map.key >> $map.foo >> >> Along with all the variants such as a map of maps, an empty map (#set >> $foo = {}), and of course using $variables as keys and values. >> >> I haven't written test cases yet, but some quick-n-dirty standalone >> testing shows it works, PLUS all existing test cases still pass. woo >> hoo! >> >> We can tweak the syntax, but I *really* like having the curly braces >> around the map. Plus, I tried to make it work with square brackets >> but >> javacc got confused with lists, and I don't understand LOOKAHEAD yet. >> >> Right now it uses a java.util.HashMap as the backing store, but I'd >> like to somehow make this configurable via WebMacro.properties, so we >> can use any Map implementation. Maybe TreeMap or some custom >> CaseInsensitiveStringKeyMapThingie so $map.Key and $map.keY are the >> same thing. >> >> Who knows. But I think this is a good start. >> >> eric >> >> > |