Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning "Deprecated injections without @inject" #56

Closed
remojansen opened this issue Jan 28, 2016 · 5 comments
Closed

Add warning "Deprecated injections without @inject" #56

remojansen opened this issue Jan 28, 2016 · 5 comments

Comments

@remojansen
Copy link
Member

We need to remove the old way of detecting injections (function.toString() + regex).

Can we add:

console.log("WARNING! Injections without inject decorator won't be supported in the upcoming releases");
@jamesadarich
Copy link
Member

Great point Remo. If we intend on changing the API then we should definitely notify people. I'm wondering though if the scope is much greater than just the decorators as we intend to make a fair few changes that will affect people's set up.

Perhaps a more general notification for people using 1.x? But then again should we be treating Inversify 1 and 2 as an upgrade or almost different libraries since the changes may be quite large.

Also may be worth thinking of creating a tool to ease the transition to convert existing set ups from 1.x to 2.x?

@remojansen
Copy link
Member Author

I don't think there is going to be a lot of incompatibilities. The main problem I can think about is the usage of injections without the @Inject decorator but if we use the warning for it should be ok.

I'm planing to do some changes to some names to make the code a bit shorter. For example:

kernel.bind(new TypeBinding<FooInterface>("FooInterface", Foo, TypeBindingScopeEnum.Transient));

I would like to use:

kernel.bind(new Binding<FooInterface>("FooInterface", Foo, BindingScope.Transient));

This won't be a big problem because users can create aliases:

var TypeBinding = Binding;
var TypeBindingScopeEnum = BindingScope;

@jamesadarich
Copy link
Member

I guess my thought is that constructing a new Binding is a bit redundant and perhaps using the opportunity to redactor to something like

kernel.bind<Interface>("Interface").to(Class).with(Binding Scope.Transient)

This will cut out the need to create a new binding and pass that in and make the syntax more fluent

@remojansen
Copy link
Member Author

👍 I was working on something similar. What I did wasn't brilliant... we can take advantage of this new feature to do something better.

@remojansen
Copy link
Member Author

Release 1.3.0 drops support for injections without ``@Inject` decorator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants