-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
In the docs it says this:
Your code is automatically wrapped in an IIFE (Immediately Invoked Function Expression) by the template, so you don't need to worry about variable conflicts. The template handles scoping for you.
... which is technically not entirely incorrect, but also not really correct, as template defines the single-letter variable names a, b, c, d and n as constant globals (as well as some other longer variable names), which can (and does) get in the way of writing size optimized code. Because it disallows to use those single-letter variables as globals in the program, unless you declare them with let but that's an extra 4-5 chars.
Suggestions:
- Fix it: Change the single-letter constant globals to
a_,b_, etc. or something similar. Or even better maybe don't make them constants, so the author can choose to overwrite them or not. Or maybe restructure the code so they don't become globals at all. - Document it: Update the docs to reflect this behaviour, cause I think "you don't need to worry about variable conflicts" is not the most accurate way to describe it. This has the disadvantage that despite being clear about it, you still can't use 5 of the single char variable names as globals (and there's only about 54 of them, afaik).
Metadata
Metadata
Assignees
Labels
No labels