GiladBracha?, a primary author of JavaLanguage and now NewSpeak, posted a couple interesting articles in 2009:
The solution Bracha promotes is to:
I'm taking this approach with a configuration language I'm developing (based on MarkupLanguageNine), using an implicit PowerBox instead of an explicit ContextObject (with ExplicitManagementOfImplicitContext, so you can access the powerbox or replace it). The idea is ween the application off the powerbox as the dependencies get deeper. Initially, I was going to use '@import' and '@export' and so on, but on Bracha's advice I'm going to try without imports.
My idea is to have each module to specify which 'service' it provides, allowing for conflicts:
@module {service=foo, ...}The idea is that I'll have a directory full of modules. Anyone who asks for '@foo' might select this particular instance. So, rather than importing by name, I'm introducing an intermediate discovery service. If there is more than one module serving 'foo', the choice is made using principles of PolicyInjection and preference heuristics. (The choice will be deterministic and traceable.) Additionally, the module receives whatever parameters. Given:
@foo {a=1, b=2, c=3} Hello WorldThe module specified with:
@module {service=foo, args={a=A, b=B, data=D}}Would receive parameters A=1, B=2, D="Hello\nWorld". The parameter 'c', in this case, is lost.
It wouldn't take much effort to produce a simplified summary of which service each module provides, dependencies, security level, policy and features for PolicyInjection, et cetera so that I don't need to parse every module on startup.