Hacker News new | past | comments | ask | show | jobs | submit login

Nope, AtScript was doing runtime type checking (AtScript is basically traceur with some experimental features) while Typescript DOESNT. To be fair , I don't care, but that's an important precision.

It means that the Angular team is giving up on traceur or maybe traceur and typescript will merge somehow in the future.




Of note, the BRAND NEW TODAY angular website still says it uses AtScript: https://angular.io/docs/js/latest/quickstart.html

ES6, AtScript, and the es6-shim AtScript

Angular is built with AtScript. AtScript is an extension of ES6 (ECMAScript 6), the new specification of the JavaScript language. This quickstart features AtScript, but you can write Angular in ES5 or ES6 as well. ES6

AtScript compiles to ES6, which is not widely supported in all browsers today. The es6-shim.js file allows you to use ES6 or AtScript in the browser. es6-shim

The quickstart repository includes es6-shim.js. The es6-shim.js file includes dependencies (such as Traceur) needed to compile ES6 in the browser. Traceur is an ES6 compiler that transpiles ES6 to ES5 code.


I don't see why anyone would want runtime type checking the way AtScript does it.

With static typing, the compiler can catch type errors early, at the cost of rejecting some otherwise valid programs.

With dynamic typing, that type checking is delayed until execution time. More programs are valid, but type errors are caught late.

With AtScript-style late type checking, they took the dynamic type system and introduced more type errors. This decreases the amount of valid programs, yet catches no errors at compile time. It does nothing but increase the amount of bugs.


You want both. Compile-time checking is necessary but not sufficient. Applications are not monoliths anymore, and web applications especially will interact with multiple other processes and services. For these you really need dynamic type checking. You can either try to do it in an ad hoc way in the application code, or building the check into the language.


You might be interested in this paper.

http://www.cs.umd.edu/~aseem/safets.pdf

It describes an extension to TypeScript that includes efficient runtime type checking. They encode type information only in situations where checks are necessary, and only information that cannot be otherwise deduced from the context.


are you talking about the typing of data received from outside sources?


Exactly. And even when you receive data from your "own" services that you have type definitions automatically generated for, maybe there's a version mismatch in a deployment somewhere and so on.


Completely agree 100%. Hopefully Typescript isn't merging any sort of runtime type checking.


I think angular is not after runtime type checking, like the TypeScript compiler. I think what they're after is keeping type information beyond `instanceof`, like keeping information about interfaces and the ability to access type properties beyond `Foo.prototype.bar`.

Edit: to clarify, runtime type information should not be used to check for types again, but rather to do things similar to Java's reflection.


The angular team designed atscript. Have a look at their doc. It does contain runtime type checking and it looks like this:

var length = rtts.type(name.length, rtts.int);

https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit9...


You're right, sorry.


You would almost never use the runtime checking in production. This is an optional feature that you would only use in development.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: