musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

3.0: Rethink consistent property names #157

Closed iccir closed 5 years ago

iccir commented 6 years ago

Back in the oj 0.x days, we were using Google's Closure Compiler with ADVANCED_OPTIMIZATIONS turned on. One of our requirements for oj (and why we couldn't use Objective-J) was consistent property names. This was before the squeezer, and before we moved to UglifyJS.

This requirement hasn't been checked or enforced in years. Moving forward, we should think if this is something we still want to support.

Even if the NilScript compiler doesn't use consistent property names, it's possible to provide a list of all N$-prefixed identifiers and prevent Closure from renaming them:

  1. Use the NilScript --output-symbols compiler option
  2. Write a script to convert the resulting JSON
  3. Pass this into Closure via the --extern option
iccir commented 5 years ago

Removed - selectors and class symbols are now strings rather than { foo:1 }.

iccir commented 5 years ago

Note: this went a bit too far. @selector should lay down an opaque type for type-checking, rather than a string. We do not want to allow:

nilscript.msgSend(target, "ArbitraryString")

iccir commented 5 years ago

Fixed in 3b2e79da2f290e2d602157b97826fb5020ef8815