[stringtemplate-interest] Embedded loader problems

Micheal J open.zone at virgin.net
Fri Sep 1 09:32:16 PDT 2006


Hi,

[...]
> // before the string template group can be used, the static 
> instance // needs to know which loader to use 
> StringTemplateGroup.RegisterGroupLoader(embeddedResourceGroupLoader);
> 
> StringTemplateGroup stringTemplateGroup = new StringTemplateGroup(
>     WebPageConstant.GROUP_TYPE_NAME,
>     embeddedResourceTemplateLoader);
> 
> StringTemplate stringTemplate =
>     stringTemplateGroup.LookupTemplate(templateTypeName);

I find the static members such as StringTemplateGroup.RegisterGroupLoader()
in the ST[#] library to be quite "ugly" actually. And they have implications
for use in a _truly_ multi-threaded environment (a real concern now that
dual-core and dual-cpu desktops are commonplace).

StringTemplateGroup should really be a self-contained manager for a
collection of StringTemplate instances. With support extending the managed
domain to include the ST notion of a tree of related StringTemplateGroups.

In this scheme, RegisterGroupLoader() et al would be an instance member on
StringTemplateGroup and it's effect would be limited to the particular
instance.

Micheal



More information about the stringtemplate-interest mailing list