You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new in the ReScript community and haven't written any working code yet. So for now, I'm just covering all the listed language features and I have to admit that I already love it.
But I've found that the usage example of the Lazy Values feature is confusing. The biggest accent in the doc is made on the fact that the value is only computed once. Yeah, that's cool, but then I've remembered about another cool feature called something like block let binding (literally a self-called function) where value is also computed once when it initialized.
And then I had a dilemma then what for..., and realized that the biggest advantage of the Lazy Values feature is the Lazy.force that gives you total control under when you want to compute the value of a variable and either want to do it at all.
So as an example I think it's more appropriate to add something like this:
We kind of define the lazy value in an upper scope, but don't compute it if this is not really necessary.
After that, I'll have a question "why not to use a normal function instead" and I'll gladly listen to your arguments that a lazy value is only computed once, doesn't have a runtime overhead etc-etc. I think at that point it will be more reasonable.
The text was updated successfully, but these errors were encountered:
I'm new in the ReScript community and haven't written any working code yet. So for now, I'm just covering all the listed language features and I have to admit that I already love it.
But I've found that the usage example of the Lazy Values feature is confusing. The biggest accent in the doc is made on the fact that the value is only computed once. Yeah, that's cool, but then I've remembered about another cool feature called something like
block let binding
(literally a self-called function) where value is also computed once when it initialized.And then I had a dilemma
then what for...
, and realized that the biggest advantage of the Lazy Values feature is theLazy.force
that gives you total control under when you want to compute the value of a variable and either want to do it at all.So as an example I think it's more appropriate to add something like this:
We kind of define the lazy value in an upper scope, but don't compute it if this is not really necessary.
After that, I'll have a question "why not to use a normal function instead" and I'll gladly listen to your arguments that a lazy value is only computed once, doesn't have a runtime overhead etc-etc. I think at that point it will be more reasonable.
The text was updated successfully, but these errors were encountered: