Please consider deprecating inferred dependencies #6717

Closed
AdrianRossouw opened this Issue Mar 17, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@AdrianRossouw

Hey There.

I've been working through what was troubling me about angular as a platform,
and I think I finally got it down to the fact that I think that the black magic around
inferred dependencies are going to cause a significant problem for the future
maintainability.

I'm not really angular's model user, because I understand that there's almost never going to be a situation where it's the right tool for what I am doing.

I was however one of the major core contributors for Drupal for many years, and although I'm no longer involved I have been able to see the effects that design decisions in major API's I have built have when used by thousands of developer over almost a decade.

That's not an appeal to authority, just letting you know from what perspective I am looking at this at. I think this is going to be a really big problem 5-10 years from now if you don't take a stand now.

I also think there is a way to keep everyone happy. It's all detailed in my blog.

http://daemon.co.za/2014/03/complexity-creeps-concerned-for-future-of-angular/

@btford

This comment has been minimized.

Show comment
Hide comment
@btford

btford Mar 17, 2014

Contributor

FYI this "problem" will not exist in ng 2.0. You can look at our new DI system on GitHub: https://github.com/angular/di.js

We (the angular team) agree that the DI annotations are added complexity.

If you have some specific changes in mind for the documentation, feel free to submit PRs to address them. Thanks!

Contributor

btford commented Mar 17, 2014

FYI this "problem" will not exist in ng 2.0. You can look at our new DI system on GitHub: https://github.com/angular/di.js

We (the angular team) agree that the DI annotations are added complexity.

If you have some specific changes in mind for the documentation, feel free to submit PRs to address them. Thanks!

@btford btford closed this Mar 17, 2014

caitp added a commit to caitp/angular.js that referenced this issue Mar 17, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  });
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Mar 17, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 1, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 2, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 2, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 7, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 9, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 10, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 10, 2014

feat(injector): optionally disable automatic function annotation
This modifies the injector to prevent automatic annotation from occurring for a given injector.

This works by passing a `true` as the 3rd or 4th parameter to createInjector(), or alternatively
to angular.module.

```js
angular.module("name", ["dependencies", "otherdeps"], configFn, true)
  .provider("$willBreak", function() {
    this.$get = function($rootScope) {
    };
  })
  .run(["$willBreak", function($willBreak) {
    // This block will never run because the noMagic flag was set to true, and the $willBreak
    // '$get' function does not have an explicit annotation.
  }]);
```

This will only affect functions with an arity greater than 0, and without an $inject property.

Related: #6717

caitp added a commit to caitp/angular.js that referenced this issue Apr 10, 2014

feat(injector): "strict-DI" mode which disables "automatic" function …
…annotation

This modifies the injector to prevent automatic annotation from occurring for a given injector.

This behaviour can be enabled when bootstrapping the application by using the attribute
"ng-strict-di" on the root element (the element containing "ng-app"), or alternatively by passing
an object with the property "strictDi" set to "true" in angular.bootstrap, when bootstrapping
manually.

JS example:

    angular.module("name", ["dependencies", "otherdeps"])
      .provider("$willBreak", function() {
        this.$get = function($rootScope) {
        };
      })
      .run(["$willBreak", function($willBreak) {
        // This block will never run because the noMagic flag was set to true,
        // and the $willBreak '$get' function does not have an explicit
        // annotation.
      }]);

    angular.bootstrap(document, ["name"], {
      strictDi: true
    });

HTML:

    <html ng-app="name" ng-strict-di>
      <!-- ... -->
    </html>

This will only affect functions with an arity greater than 0, and without an $inject property.

Closes #6719
Closes #6717
Closes #4504
Closes #6069
Closes #3611

caitp added a commit to caitp/angular.js that referenced this issue Apr 11, 2014

feat(injector): "strict-DI" mode which disables "automatic" function …
…annotation

This modifies the injector to prevent automatic annotation from occurring for a given injector.

This behaviour can be enabled when bootstrapping the application by using the attribute
"ng-strict-di" on the root element (the element containing "ng-app"), or alternatively by passing
an object with the property "strictDi" set to "true" in angular.bootstrap, when bootstrapping
manually.

JS example:

    angular.module("name", ["dependencies", "otherdeps"])
      .provider("$willBreak", function() {
        this.$get = function($rootScope) {
        };
      })
      .run(["$willBreak", function($willBreak) {
        // This block will never run because the noMagic flag was set to true,
        // and the $willBreak '$get' function does not have an explicit
        // annotation.
      }]);

    angular.bootstrap(document, ["name"], {
      strictDi: true
    });

HTML:

    <html ng-app="name" ng-strict-di>
      <!-- ... -->
    </html>

This will only affect functions with an arity greater than 0, and without an $inject property.

Closes #6719
Closes #6717
Closes #4504
Closes #6069
Closes #3611

caitp added a commit that referenced this issue Apr 11, 2014

feat(injector): "strict-DI" mode which disables "automatic" function …
…annotation

This modifies the injector to prevent automatic annotation from occurring for a given injector.

This behaviour can be enabled when bootstrapping the application by using the attribute
"ng-strict-di" on the root element (the element containing "ng-app"), or alternatively by passing
an object with the property "strictDi" set to "true" in angular.bootstrap, when bootstrapping
manually.

JS example:

    angular.module("name", ["dependencies", "otherdeps"])
      .provider("$willBreak", function() {
        this.$get = function($rootScope) {
        };
      })
      .run(["$willBreak", function($willBreak) {
        // This block will never run because the noMagic flag was set to true,
        // and the $willBreak '$get' function does not have an explicit
        // annotation.
      }]);

    angular.bootstrap(document, ["name"], {
      strictDi: true
    });

HTML:

    <html ng-app="name" ng-strict-di>
      <!-- ... -->
    </html>

This will only affect functions with an arity greater than 0, and without an $inject property.

Closes #6719
Closes #6717
Closes #4504
Closes #6069
Closes #3611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment