massive-oss / minject

A Haxe port of the ActionScript 3 SwiftSuspenders IOC library with efficient macro enhanced type reflection. Supports AVM1, AVM2, JavaScript, Neko and C++.
open.massiveinteractive.com
Other
54 stars 22 forks source link

V2 api improvements #44

Closed dpeek closed 9 years ago

dpeek commented 9 years ago

@jasononeil OK, so hopefully the last round of big changes, mostly internal APIs but also some that might affect you. Some testing would be much appreciated, hopefully I can still get v2 out before Saturday!

dpeek commented 9 years ago

The important changes are in Injector. Basically:

The rest is just project cleanup and using our new build tool for some stuff.

I'm open to feedback on the API renaming – ...ForTypeId makes for some long method names but I wanted to be clear what the difference was with the macro versions.

Another idea I has was Injector.useValue(value) which would basically be like mapValue but it gets the type from the value itself (kind of like mapSingleton for other types I guess)

dpeek commented 9 years ago

Ah hah. One or two more changes :)

Hard to argue that the changes aren't for the better, though.

jasononeil commented 9 years ago

That does look more readable... I'll try look at it tomorrow. I've got several projects with fairly complex DI, though they are each similar use cases. Hopefully it'll be a sufficient test though...

dpeek commented 9 years ago

I basically took a look at swift suspenders v2 and got inspired. I'm just trying to figure out how to bring some stricter typing into the equation, but the primitive/class thing is making it tricky.

dpeek commented 9 years ago

I'm also thinking of making map work with type identifiers so that mapType isn't needed publicly. For the map value use case we could add another specific method which detects the type of the value.