3 ms·
I actually wrote a short blog post about this just recently: https://engineersjourney.wordpress.com/2017/08/01/history-of-let/ https://engineersjourney.wordpres
by tuturto 9y ago
I actually wrote a short blog post about this just recently: https://engineersjourney.wordpress.com/2017/08/01/history-of-let/ https://engineersjourney.wordpress.com/2017/08/01/history-of...
In short, let kept running into trouble with yield, exceptions, breaking out of loops and such. It would have been really tricky (probably close to impossible) to get everything working correctly.
- bshanks 9y agoIn case i ever find myself designing a programming language, what facilities would Python have to support in order to allow 'let' to work? It seems to me that in theory Hy could solve the problem with which variables are to be marked 'nonlocal' by doing a lot of additional code analysis (is this correct?). I gather that the main remaining problem is that break, continue, yield, async, await work differently if you covertly introduce a new function scope. Would it be sufficient if scopes could have explicit labels and break, continue, yield took an argument that said which label to break/continue/yield out of? Would that solve the problem with async, await too? If Hy did extensive code analysis to determine where to introduce 'nonlocal', and if Python's break/continue/yield took this extra argument, would implementation of 'let' by Hy then become possible or are there still additional impediments that i am missing?
- bshanks 9y ago(tuturto responded to the parent of this comment at https://engineersjourney.wordpress.com/2017/08/01/history-of-let/#comment-292 https://engineersjourney.wordpress.com/2017/08/01/history-of... )