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

Language: Deprecate implicit imports and hidden globals #125

Open
wcjohnson opened this issue Jul 15, 2020 · 0 comments
Open

Language: Deprecate implicit imports and hidden globals #125

wcjohnson opened this issue Jul 15, 2020 · 0 comments

Comments

@wcjohnson
Copy link
Owner

As a start to ushering in a cleaner language for static analysis/merging with TypeScript, my objective is to clean up areas where there is implicit or hidden pollution of globals. This involves the following steps:

Deprecate Lightscript stdlib/Lodash implicit imports

  • Non-breaking stdlib deprecation path
  • { stdlib: false } is now a default option
  • Those wanting old behavior can set { stdlib: true } in compiler config

Deprecate implicit global operators

  • looseEq, looseNotEq, bitwise* implicit globals will be removed
  • Those desiring old behavior can set { implicitGlobalOperators: true } in compiler opts
  • Option removed altogether in 5.x
  • Instead, import { looseEq, ... } from '@lightscript/lang' at top level
  • Compiler will detect this and treat it as a virtual import, replacing with compiled code
  • A nonce module will be published to npm as @lightscript/lang to aid with static analysis

Deprecate implicit lightscript runtime imports

  • @lightscript/runtime will no longer be implicitly imported
  • Those desiring old behavior can set { implicitRuntime: true } in compiler opts
  • Option removed altogether in 5.x
  • When the compiler encounters a construct requiring the runtime, it will check for import runtime from '@lightscript/runtime' at top level
  • If the runtime is not imported, an error is thrown
  • A lint rule will be added to check for constructs that require the runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant