Conversation
|
Generally, very very +1. Awesome. @stefanpenner This suggests that the Ember WeakMap would not support map -> key weakness. Correct? If so, |
|
Destroying the weakmap itself would have no affect. The data would just become inaccessible and require the keys be reclaimed before |
|
In this case the WM is basically just a way to store private state on an object without polluting or causing shape issues. In essence opening meta in a safe way as a baking store to userland. Primarily targeted at pro user addons features |
|
"Motivation" should likely include the specific Ember features this would be used for. To quote Stef via chat:
There are some addons that would use this:
Though those could also consume WeakMap as a stand-alone library instead. The stand-alone version would be dependent on Ember edit: @ef4 reminds me this is not actually a viable alternative, as the |
|
Actually it isn't that meta is created on demand that is the problem. We can trigger its creation from userland. The issue is more of shaping. We can't ensure meta shapes correctly with this new slot. Unless we can insert the slot in its constructor. In theory run times should be able to adapt to afew dynamic slots added. In reality, we blow our budget of such flexibility easily. We will publish a polyfil addon, so older code can use it. Unfortunately that addon will be stuck causing meta to have different slots |
|
@stefanpenner based on the WeakMap spec, Related: thoov/ember-weakmap#3 |
|
we should follow the spec https://tc39.github.io/ecma262/#sec-weakmap.prototype.delete so returning true/false |
|
looks like the one in ember does this: https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/weak_map.js#L89-L101 fixed by @mmun emberjs/ember.js@bce8ed3 |
|
This RFC is still required to eventually make it public, as i believe the built-in weakmap is still private. |
|
Looks good 👍 |
|
next step: emberjs/ember.js#13668 |
…tal-hooks Promote buildInstrumentation to public API
rendered