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
How does this proposal relate to the do block and explicit resource management proposals? I'm noticing that the basic functionality of both of these proposals can trivially be implemented with this proposal. I know this proposal has had a bit of a rocky start (as stated in #35), but perhaps if we're able to resolve some of its core issues (with break/continue/etc) and simplify it, it may have a chance. And, considering that this single proposal is powerful enough to potentially replace two other proposals, it may be to our advantage to really give this proposal another chance.
The do-block proposal can be simulated by providing a built-in identity function that will simply call the expression-block passed into it.
// The do-block proposalconstresult=do{letx=Math.random()x*x}// This proposal, with a built-in identity function called "run".constresult=run{letx=Math.random()x*x}
Earlier versions of the resource-management proposal let you create a block using with, and allocate a resource for the duration of that block, like this:
They also had the ability to do resource-management logic with declarations, because it was a little more powerful this way (you could reuse the existing block), then later decided to drop the with syntax altogether to simplify things. While we can't simulate the declaration version of this proposal, we can still provide the with version, and that could be good enough to make it so we don't need the resource-management proposal at all.
The text was updated successfully, but these errors were encountered:
How does this proposal relate to the do block and explicit resource management proposals? I'm noticing that the basic functionality of both of these proposals can trivially be implemented with this proposal. I know this proposal has had a bit of a rocky start (as stated in #35), but perhaps if we're able to resolve some of its core issues (with break/continue/etc) and simplify it, it may have a chance. And, considering that this single proposal is powerful enough to potentially replace two other proposals, it may be to our advantage to really give this proposal another chance.
The do-block proposal can be simulated by providing a built-in identity function that will simply call the expression-block passed into it.
Earlier versions of the resource-management proposal let you create a block using
with
, and allocate a resource for the duration of that block, like this:If we provide a built-in withResource() function that operates on an object that implemented a particular protocol, we could get similar results:
They also had the ability to do resource-management logic with declarations, because it was a little more powerful this way (you could reuse the existing block), then later decided to drop the
with
syntax altogether to simplify things. While we can't simulate the declaration version of this proposal, we can still provide thewith
version, and that could be good enough to make it so we don't need the resource-management proposal at all.The text was updated successfully, but these errors were encountered: