-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for "let" #2000
Comments
Adding this would be easy, the only question really is whether it will be more confusing to support it but with incorrect scoping (this applies to const already though, as you pointed out). |
Hi, I've run into a site using these on edbrowse. They'd actually be fine with As you wrote ages ago this is pretty easy, I've monkeyed something that appears to work here if that's of any help (although I'm not sure on how that strings.yaml generates other files?): I can open a PR with it after adding some note in the documentation / tests but honestly would prefer the topic of "is a partial feature better than nothing" first; I definitely agree it's confusing, it just so happens that my use case in the wild would work with var instead... Thanks! |
The diff looks quite good to me at first glance -- feel free to open a PR. I can write some partial feature tests and release documentation as a follow-up if you prefer. |
Hi Guys, I agree that allowing let keyword without standard behavior may confuse someone. However it would also allow reusing code that uses 'let' and in my books benefits of reusing code outweighs possible confusion. If I would have a vote, it would go to const-like let support. |
I had pretty much totally forgotten about it, started looking at how tests work just now. I probably should have taken svaarala's offer up last year, but if I don't find time to whip some basic tests/doc up by monday I'll just open a PR with what I had and leave the rest up to them... Sorry for the delay! |
@martinetd Let me know how you want to proceed :) No worries about the delay, I'm struggling to find time myself right now also. |
@martinetd Would be awesome if you could create that PR! :) Small note: let size = 2; // works great
for(let i = 0; i < size; ++i) { // "Syntax Error: parse error"
} |
@svaarala I tried to take @martinetd's diff and add a test case, but I'm still pretty lost on this: The (I was able to fix |
@Squareys thanks - please do take over, I'm a bit swamped... I did have a look at how tests run but didn't have the node.js requirements during the little time I could make in a train and that was it since :( The help is appreciated :) |
If you are OK with Docker, the easiest approach is to use the docker shell:
This runs a shell inside a docker image with all dependencies required for development in place. The work directory will be a copy and any changes are intentionally lost as you exit the Docker shell. (If you want the working copy to be mounted as is, use Then inside the shell just:
This should complete with exit code 0. Note that a bunch of known issues are listed, this is expected:
The summary is a bit misleading, it should say "32 known". |
@Squareys
EDIT:
|
@e2iplayer Great, yeah, I have that above link to the diff. Wasn't able to put more time into this, sorry! |
@Squareys Squareys |
@e2iplayer Uhm, it works fine for me 🤔 Otherwise use https://github.com/Squareys/duktape/tree/let-support |
@Squareys As you see it is short cut with dots. |
We miss let in the parser. |
"const" already is at least possible to use, even though it's the
var
semantics. Usinglet
though results in a SyntaxError. I thinklet
could at least be supported likeconst
already is even now, full support notwithstanding.The text was updated successfully, but these errors were encountered: