Closed zheeeng closed 3 years ago
Just wrap it in a function? Not every case needs to be lazy.
I feel like this would be more of a "gotcha!" than a feature. Also, consider this case:
let a = 2;
const x = do {
let tmp = 4;
tmp + a
}
a = 4;
if (true) {
console.log('x is', x); // does this print 6 or 8?
}
I feel like this would make the behavior of this function way less obvious. Lazily evaluated variables might be a nice-to-have, but I don't think this is the right place.
That would be a pretty different thing than what is proposed here; I think it would need to be pursued as a different proposal. (Separately, I personally would not be in favor of it.) I'm going to close this issue as I don't think we ought to consider it an open question for this proposal.
For better performance consideration. Expect