On 5 Jan 2012, at 23:12, Alex Harui wrote:

You can inject at compile time unless you can only determine what to inject
at runtime.  Like locales, automated testing engines, themes.

There are use cases for both. A good DI implementation will support both. I have a further goal that compile-time DI would be "legal ActionScript" in
that you could output the AS that is going to run. (Sort of like the
-keep-generated-actionscript option today). That would make it a whole lot
easier to debug.

--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Thats exactly what I was thinking.

So, something like,

[Inject]
private var test:Foo

for a singleton becomes

private var myFoo:Foo = Context.getInstance().foo;

and a factory if a singleton isn't required

private var myFoo:Foo = Context.getInstance().getFoo();


Tink

Reply via email to