diff --git a/text/0754-default-managers.md b/text/0754-default-managers.md new file mode 100644 index 0000000000..6a807cb4f0 --- /dev/null +++ b/text/0754-default-managers.md @@ -0,0 +1,455 @@ +--- +Stage: Accepted +Start Date: 2021-05-17 +Release Date: Unreleased +Release Versions: + ember-source: vX.Y.Z + ember-data: vX.Y.Z +Relevant Team(s): Ember.js, Learning +RFC PR: https://github.com/emberjs/rfcs/pull/754 +--- + +# Default Managers + +## Summary + +Anything that can be in a template has its lifecycle managed by the manager pattern. +Today, we have known managers for `@glimmer/component`, `@ember/helper`, etc. +But what happens when the VM encounters an object for which there is no manager?, +such as a plain function? This RFC explores and proposes a default behavior for +those unknown scenarios. + +## Motivation + +The addon, [ember-could-get-used-to-this](https://github.com/pzuraq/ember-could-get-used-to-this) +demonstrated that it's possible to use plain functions for helpers and modifiers. +And since Ember 3.25, helpers can be invoked directly from value references, this opened +a whole new world of ergonomics improvements where a dev could define a function in a +component class and use that function **as** a helper, thanks to +ember-could-get-used-to-this implementing a Helper Manager that _knew what to do with plain functions. + +This has the impact of greatly reducing helper burden for apps and addon devs, in that, +folks no longer need to jump over to the app/addon helpers directory to create a helper +"just to do this one simple thing". It's all now `{{this.myHelper}}` or `{{this.myModifier}}`. + +This has the added benefit of, with template strict mode, using plain functions in module-scope +for helpers and modifiers. + +For Example: + + + +```jsx +const double = num => num * 2; +const resizable = element => { /* ... */ }; + + +``` +_Note: `