Constants Namespaces in .tt files
Jan. 1st, 2011 12:46 pmI'm looking for feedback on Bug 3170: Constant Namespaces in DW::Template.
Basically, right now our constants in .tt files can be found under email.*, site.*, roots.*, etc, and the more constants we have, the more likely it is that we'll accidentally have a namespace collision. So I would like to have all constants be under just the site namespace.
That is, instead of using:
email.webmaster
roots.site
site.name
We can use:
site.email.webmaster
site.root
site.name
In some cases, it's longer, but the additional clarity should be worth the extra characters. (Plus it would also make it easier to avoid mistakes -- I found several instances of dw.* in the files, which are blank, but luckily cause no issues)
( List of proposed new namespace )
I'd like to point out, in particular,
site.name = $LJ::SITENAME
site.names.short = $LJ::SITENAMESHORT
site.names.abbrev = $LJ::SITENAMEABBREV
which suffers from inconsistency/needing to be aware of the technical limitations.
An alternative:
site.name.site = $LJ::SITENAME
site.name.short = $LJ::SITENAMESHORT
site.name.abbrev = $LJ::SITENAMEABBREV
But that suffers from the problem that the most commonly used variable, site.name, becomes long/ridiculous/redundant.
Basically, right now our constants in .tt files can be found under email.*, site.*, roots.*, etc, and the more constants we have, the more likely it is that we'll accidentally have a namespace collision. So I would like to have all constants be under just the site namespace.
That is, instead of using:
email.webmaster
roots.site
site.name
We can use:
site.email.webmaster
site.root
site.name
In some cases, it's longer, but the additional clarity should be worth the extra characters. (Plus it would also make it easier to avoid mistakes -- I found several instances of dw.* in the files, which are blank, but luckily cause no issues)
( List of proposed new namespace )
I'd like to point out, in particular,
site.name = $LJ::SITENAME
site.names.short = $LJ::SITENAMESHORT
site.names.abbrev = $LJ::SITENAMEABBREV
which suffers from inconsistency/needing to be aware of the technical limitations.
An alternative:
site.name.site = $LJ::SITENAME
site.name.short = $LJ::SITENAMESHORT
site.name.abbrev = $LJ::SITENAMEABBREV
But that suffers from the problem that the most commonly used variable, site.name, becomes long/ridiculous/redundant.