Skip to content
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

Localize loop iterators #12

Closed
UnexomWid opened this issue May 9, 2020 · 0 comments
Closed

Localize loop iterators #12

UnexomWid opened this issue May 9, 2020 · 0 comments
Assignees
Labels
added The requested feature was added approved The request or addition was approved improvement Improvement request or addition

Comments

@UnexomWid
Copy link
Owner

UnexomWid commented May 9, 2020

The loop iterators are stored in global variables. Evidently, this is bad practice. It was a temporary solution which must now be rethought. It would be better to store them in a local object, so the renderer doesn't affect the global object.

This means that the compiler needs a heuristic to determine if a token is an iterator (e.g. not a string or property of another object, not included in another token, etc). If so, it should prepend a prefix like local., which the renderer can use to refer to the local object.

[|@ item : array |] // Stays 'item'
    [|item|]        // Changes to 'local.item'
    [|"item"|]      // Stays '"item"'
[|end@|]
@UnexomWid UnexomWid added approved The request or addition was approved improvement Improvement request or addition labels May 9, 2020
@UnexomWid UnexomWid self-assigned this May 9, 2020
@UnexomWid UnexomWid added the added The requested feature was added label May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added The requested feature was added approved The request or addition was approved improvement Improvement request or addition
Projects
None yet
Development

No branches or pull requests

1 participant