4 ms·
> Type annotations are a strict subset of the "this" that AtScript seeks to accomplish. like? > "Need" is a fuzzy term, but I think it clearly benefits from a
by malandrew 12y ago
> Type annotations are a strict subset of the "this" that AtScript seeks to accomplish.
like?
> "Need" is a fuzzy term, but I think it clearly benefits from a new language with new syntax fitted for the semantics rather than trying to hide new functionality in a separate sublanguaged inside JS comments as you suggest.
When I used "need" I was suggesting that the syntax proposed did not have to be a mandatory part of adopting this feature. If you break this isn't smaller single purpose modules, you leave people the option of choosing your special syntax or choosing to build upon most of your work to make something that doesn't break all your existing tooling. Clojurescript and PureScript are example of a compile-to-javascript languages that needed another format. In the case of clojurescript, only another syntax will afford you the power of S-expressions. My objection with AtScript is that the new syntax could have been a completely optional interface for getting the benefits of the tooling actually doing the heavy lifting in this module.
> in any case preprocessing comment annotations in what is otherwise JS to generate additional JS code for runtime type checking is creating a new compile-to-JS language, its just putting the code for that new language in something that looks like JS comments, so it would still be doing exactly the thing you say shouldn't be done (or, in other words, your suggested alternative suggests that we must really need another compile to JS language to do this, since your alternative still creates such a language.)
Not exactly. Using comments allows my code to remain as vanilla JavaScript and therefore continues to work with all other off the shelf tooling out there. Asking me to adopt an entire new code format for what could have worked just fine as an extension of the standard format out there (i.e. vanilla javascript) is onerous and unnecessary. Requiring a new format requires me to through out my linters (eslint, jshint, jscs) and my parsers (esprima, acorn) and any tooling built on those parsers (ternjs, node-falafel, escodegen, browserify, sourcegraph, source maps tooling)
- dragonwriter 12y ago> When I used "need" I was suggesting that the syntax proposed did not have to be a mandatory part of adopting this feature. And...its not. The two identified components that exist now are the Traceur transpiler which generates JS from AtScript and the RTTS (runtime type system) library which works on the resulting JS. While clearly the principal intended usage model is using both together, you can use RTTS with JS without using Traceur to generate the JS from AtScript.
- jbergens 12y agoThere seems to be things related to Angular that would not work without the annotations. That means the comments you suggest would have to be parsed, otherwise your Angular code would break.