LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
TL;DR: There could be some mention about that fact in the documentation.
Because of how for..let loops wrap their bodies in the function, you cannot use break and continue in them. Hacking them to work, with labels, would be a bigger challenge, not impossible (Babel has it), but probably not worth the effort. That's why I believe that it is as intended, but I think this limitation should be documented.
However, one of the bummers in ES5 were, that you couldn't at the same time use break or continue and be having an iteration scoped variables, like in Array.prototype.map, at the same time. So the ES6 added lets and consts. But because in LS they are emulated using ES5 tricks, they come with ES5 limitations.
And perhaps there are more use cases, where JS lets make more sense, than LS helpers, though nothing comes to my mind at the moment.
And I also don't think it is super important. I would probably find a simple way to get around such issue in my code.
In summary, options "what to do":
leave as it is, but document better
implement them, but only on basic level
implement them, but fully, with labels
implement a fallback to a real let
introduce a real let anyway, everywhere
introduce a real let, but through Babel pipeline
I would opt for the first one or the Babel one, but that's another issue (#821?).
EDIT: Later I thought that using ``let ii = i;`` could bypass the problem.
EDIT2: Later I thought that using a simple loop with let i block just for a function could bypass the problem with just LS mechanisms. Okay, disregard the "(discussion)" part, this issue is now just for the sake of a mention in the documentation.
TL;DR: There could be some mention about that fact in the documentation.
Because of how
for..let
loops wrap their bodies in the function, you cannot usebreak
andcontinue
in them. Hacking them to work, with labels, would be a bigger challenge, not impossible (Babel has it), but probably not worth the effort. That's why I believe that it is as intended, but I think this limitation should be documented.However, one of the bummers in ES5 were, that you couldn't at the same time use
break
orcontinue
and be having an iteration scoped variables, like inArray.prototype.map
, at the same time. So the ES6 addedlet
s andconst
s. But because in LS they are emulated using ES5 tricks, they come with ES5 limitations. And perhaps there are more use cases, where JSlet
s make more sense, than LS helpers, though nothing comes to my mind at the moment.And I also don't think it is super important. I would probably find a simple way to get around such issue in my code.
In summary, options "what to do":
let
let
anyway, everywherelet
, but through Babel pipelineI would opt for the first one or the Babel one, but that's another issue (#821?).
EDIT: Later I thought that using
``let ii = i;``
could bypass the problem. EDIT2: Later I thought that using a simple loop withlet i
block just for a function could bypass the problem with just LS mechanisms. Okay, disregard the "(discussion)" part, this issue is now just for the sake of a mention in the documentation.