From 7532d2a4471ee639a7830170c817662622086464 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli Date: Mon, 17 May 2021 09:41:40 -0400 Subject: [PATCH 1/8] Fill out Summary and Motivation sections --- text/0000-default-managers.md | 111 ++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 text/0000-default-managers.md diff --git a/text/0000-default-managers.md b/text/0000-default-managers.md new file mode 100644 index 0000000000..b26d88ba6a --- /dev/null +++ b/text/0000-default-managers.md @@ -0,0 +1,111 @@ +- Start Date: 2021-05-17 +- Relevant Team(s): Ember.js, Learning +- RFC PR: (after opening the RFC PR, update this with a link to it and update the file name) +- Tracking: (leave this empty) + +# 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: `