On Thu, 2010-12-16 at 19:06 +0100, Alexis Sukrieh wrote:
We already have a "plugins" namespace and an "engine" one, so I suppose it definitely makes sense to add namespace, whose name would be the appname, for instance:
# config.yml appname: "fooapp" logger: "console" ...
plugins: .... engines: ....
fooapp: some_user_defined_var: 42 ...
Anything that is defined in the top-level would be considered Dancer's core property.
This would allow for specific checks, and could protect users from using a key that would become Dancer-native in future versions.
I like that idea, but my main concern here is backward-compat, as I said...
Personally, I like the simplicity of being able to shove your app's own config at the top level of the config file, and just say e.g. config->{foo} in your code. If we were having this discussion at the start of the project before anyone had started to use that, avoiding it could make sense, but I'm not sure I'd vote to deprecate it now. If we did decide to recommend that an app's own config settings go under 'appname' in the config, then I think we should have an app_config keyword which returns that, so you can say app_config->{foo} rather than config->{appname}{foo} (urgh, hardcoded appname) or config->{ config->{appname} }{foo} - neither of which are pretty. Cheers Dave P -- David Precious ("bigpresh") http://www.preshweb.co.uk/ "Programming is like sex. One mistake and you have to support it for the rest of your life". (Michael Sinz)