[stringtemplate-interest] Suggestion for ST Maps

Swapnil Kashikar swapnil.kashikar at gmail.com
Thu Aug 13 10:07:31 PDT 2009


Hi,

In the Maps we are using the values are pretty complex templates using
the big string syntax <<...>>
Further, multiple keys use the exact same templates as values  and we
have to repeat the big template strings for each of these keys in the
map.

Now we could factor out the repeated value templates into a different
named template and refer those in maps to simplify, but still I think,
it would help if Map syntax itself allows multiple keys to map to same
value.
Something like:

====
typeInitMap ::= [
        "int","long","byte","short","char":"0",
        "float","double":"0.0",
        "boolean":"false",
        default:"null" // anything other than an atomic type
]
====

instead of what current ST requires:

====
typeInitMap ::= [
        "int":"0",
        "long":"0",
        "float":"0.0",
        "double":"0.0",
        "boolean":"false",
        "byte":"0",
        "short":"0",
        "char":"0",
        default:"null" // anything other than an atomic type
]
====
Note: above is for illustration, not our real ST.

Thanks,
Swapnil


More information about the stringtemplate-interest mailing list