-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy state: Maybe remove $ #780
Comments
We can remove a lot of docs by doing this you know. We just need an expandable box saying something like "when you reference state at the top level, it will always be lazily evaluated. Here's what the compiler does to your code". |
One issue here is that at the top level, this is not allowed:
That fails today, and it fails if we treat But if we treat state as a lazy reference, it's hard to explain why it fails. I wish we head a really good, tight, easy to understand explanation of:
|
Lazy state is proving a bit hard for people (even people on the team) to understand
The story for new users is:
Cool, but then they open up a callback and it breaks. So now the rule is:
Which I suppose isn't too bad, but does require a certain mindfulness.
Why don't we drop
$
entirely and just treatstate
as a special entity in the compiler? All the rules we apply to$
now just apply to the special variable state. Which means: if we seestate
passed into an operation at the top level, we wrap it up in a lazy function.Reasons for:
Reasons against:
const state = {}
. But that's true anyway, and why would you do that? We could even compiler warn against thisI'm warming to the idea that we go ahead and do this. I think we do still need to document something about what's happening, especially if users look at their compiled code. But it would be heavy advanced stuff.
The text was updated successfully, but these errors were encountered: