cc/ @littledan
-
-
Yeah. Think of JSX / VDOM. You have a deeply nested call hierarchy that represents some state kept elsewhere. You invoke this repeatedly over time to get the new state, but sometimes you need to access the old state. Keying that old state by source location would work perfectly.
-
Not sure that's a common use case to justify as language feature, but for sure not too hard to implement without runtime overhead.
-
VDOM is extremely common though, and if it could more easily reconcile without the diff a significant amount of the web could benefit.
-
I wonder if there's a good way this could be experimented with in tooling, before putting it as a built-in feature. Some horrible hack with error stacks, looking at the top two entries???
-
Pinging here, because the new React Hooks feature is trying to tie a callsite to a state object almost exactly like my use case, and accomplishes it in the same hacky way that I considered: keep a stack of invocations and disallow conditionals.https://reactjs.org/docs/hooks-intro.html …
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.