cspotcode / cspotcode/angl

`require` can be overridden by Angl code

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
0 - Backlog
Dominant language
TypeScript
Stars
1
Forks
3
PR merge metrics
No merged PRs in 30d

Description

_Copied from cspotcode/angl-compiler#4 repo_

require function should be aliased to a different name to prevent it from being overridden by Angl local variables.

On the other hand, lots of Javascript stuff can be overridden by local variables, such as window. Perhaps there should be a blacklist for local angl variable names. Any variable with a name on that blacklist becomes an "unnamed" identifier that is assigned a non-blacklist name.

For example, var window becomes var window0

---

That's a good point that access to require probably won't be "required" (hohoho puns) within Angl functions. I'd still like to consider implementing a blacklist to force certain local variable names to be rewritten. It shouldn't be too bad to implement. That way if I ever need to, for example, make an inline call to Math.round, for example, I can add Math to the blacklist.

Alternatively we could do var $Math = Math or $ART.Math = Math and I'm ok with those, but I personally prefer the former solution better.

---

Probably best to just use everything in that $... namespace. Since $ is not allowed in Angl identifier names, anything beginning with $ is safe.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.