puffnfresh / roy

Small functional language that compiles to JavaScript.
http://roy.brianmckenna.org/
MIT License
834 stars 74 forks source link

make fallback to JavaScript global explicit #140

Closed dckc closed 8 years ago

dckc commented 12 years ago

In types.rst, I see:

Referring to unknown identifier will assume that the identifier refers to a native JavaScript global.

?!

Is that really on purpose? introduction.rst says implicit globals are dangerous, no?

JavaScript has the var keyword to create local variables but unqualified assignments write to the global object:

How about an analog to the /* global */ directive from JSLint?

JSLint also recognizes a /global/ directive that can indicate to JSLint that variables used in this file were defined in other files."

sophiebits commented 12 years ago

Seconding this. This in conjunction with #17 would make JS globals much nicer.

dckc commented 8 years ago

My interest in this issue is overtaken by the emergence of purescript.