Update: As of Google and Microsoft’s new partnership on Angular 2, AtScript will be combined with Microsoft’s TypeScript superset programming language.

Google’s continuing quest to improve JavaScript took another step forward with the unveiling of AtScript, a new superset JavaScript runtime type system written into AngularJS 2.0.

Rather than create another new programming language—Google has already done that with Dart—AtScript is designed to run on top of not only ECMAScript 5 and the upcoming ECMAScript 6, but atop Microsoft’s superset TypeScript language as well. The goal of AtScript is to make type annotation data available at runtime, also known as type introspection, in an effort to enhance JavaScript with type, field and metadata annotations.

Google revealed AtScript at ngEurope in Paris last week, the first European conference dedicated to the AngularJS framework. According to Google’s presentation, AtScript is a purely optional, albeit recommended option to extend JavaScript to annotations and typing in AngularJS 2.0. As with TypeScript, AtScript code automatically compiles to JavaScript, using nominal types to improve JavaScript syntax while still maintaining complete semantic compatibility with ECMAScript 5 and 6.

According to Google’s open-source AtScript Primer, the superset runtime was inspired by characteristics of both TypeScript and Dart, but is designed to improve upon TypeScript’s lack of dynamic analysis capabilities, metadata annotations and runtime annotation access, and Dart’s semantic differences to JavaScript.

AtScript is, in the eyes of Google and the AngularJS team, another step in the evolution of JavaScript. ECMAScript 6 adds classes and modules to JavaScript, TypeScript sits on top of it with types, and AtScript lays annotations and introspection on top of TypeScript.

In the primer, the AngularJS team laid out the current status and future plans for AtScript. The AtScript syntax is serving as the foundation for AngularJS 2.0, which is being written on top of it. AtScript uses the open-source Traceur compiler to ingest the AtScript syntax, generate ECMAScript code and transpile the code into Dart or JavaScript. The Assert.js library is used to add types. Plans for AtScript include:

• A standalone type system static analysis tool, similar to the Dart Analyzer or TypeScript.
• More support for generics in the runtime type system, beyond arrays and maps.
• ECMAScript 5+ClosureAnnotation output to allow integration with existing Closure projects.
• Source maps support for easier debugging and translation of stack trace line numbers.

Screen Shot 2014-10-27 at 12.52.09 PM

The AtScript “road map” from the AngularJS team

AngularJS creator Miško Hevery sees AtScript as ECMAScript 6 plus annotations. He believed AtScript has the potential to work in tandem with ECMAScript 6 and TypeScript to implement official types in JavaScript, and detailed plans to ultimately push for an AtScript standard in JavaScript.

“Our plan is to use AtScript for building Angular and optionally let users of Angular leverage AtScript to build their own applications,” Hevery wrote in the AtScript primer. “AtScript is independent of Angular and as such we think it would be useful for other non-Angular projects. Once we prove the usefulness of this approach and get a better handle on the corner cases by building real world applications, we would like to offer it to the standardization bodies. We think it is generally agreed upon that types are something people would like to see in JS. What seems to be under contention is: What do these types mean? AtScript specifically defines syntax, but stays clear of the semantic discussion; therefore we think it would be a good introductory step towards official types in JavaScript.”

More information on AtScript can be found in Google’s slideshow from ngEurope and in this AtScript Q&A from the AngularJS team.

About Rob Marvin

Rob Marvin has covered the software development and technology industry as Online & Social Media Editor at SD Times since July 2013. He is a 2013 graduate of the S.I. Newhouse School of Public Communications at Syracuse University with dual degrees in Magazine Journalism and Psychology. Rob enjoys writing about everything from features, entertainment, news and culture to his current work covering the software development industry. Reach him on Twitter at @rjmarvin1.