1 of 41

2 of 41

AtScript

We are NOT building a language

3 of 41

We you

and we would not force a language upon you

and we are sorry about our APIs

4 of 41

module.directive('blink',

['$timeout', function($timeout) {

return {

require: 'options',

restrict: 'A',

link: function(_,element,__,options){

var selectors = someThirdPartyAPI();

element.query(selectors.join(','))

.forEach(e => options.apply(e));

}

};

}]);

5 of 41

module.directive('blink',

['$timeout', function($timeout) {

return {

require: 'options',

restrict: 'A',

link: function(_,element,__,options){

var selectors = someThirdPartyAPI();

element.query(selectors.join(','))

.forEach(e => options.apply(e));

}

};

}]);

6 of 41

module.directive('blink',

['$timeout', function($timeout) {

return {

require: 'options',

restrict: 'A',

link: function(_,element,__,options){

var selectors = someThirdPartyAPI();

element.query(selectors.join(','))

.forEach(e => options.apply(e));

}

};

}]);

Array<CssSelectors>

Element

7 of 41

@Directive({

selector: ['[blink]']

})

class Blink {

constructor(element:Element,

options:Options,

timeout:Timeout) {

var selectors:Array<CssSelectors> =� someThirdPartyAPI();

element.query(selectors.join(','))

.forEach(e => options.apply(e));

}

}

8 of 41

We are sorry

We will make it right

9 of 41

Why NOT build a language?

10 of 41

11 of 41

Ideal Development Environment

Introspection

Metadata

Optional�Types

AtScript

12 of 41

Contracts

13 of 41

// Public API

function addClass(selectors, name) {

document

.querySelectorAll(selectors.join(','))

.forEach(e => e.classList.add(name));

}

14 of 41

// Public API

function addClass(selectors, name) { ... }

15 of 41

// Public API

function addClass(

selectors:Array<CssSelectors>,

name:string) { ... }

16 of 41

// Public API

function addClass(

selectors,

name)

{

// Generated Code

assert(selectors).is(Array.of(CssSelector));

assert(name).is(string);

...

}

17 of 41

RTTS - Asserts

  • Nominal Type System
    • Array�
  • Structural Type System
    • CssSelector�
  • Generics:
    • Array<CssSelector>

18 of 41

Check the server

JSON response

for correct type

19 of 41

Declarative Metadata

20 of 41

module.directive('blink',

['$timeout', function($timeout) {

return {

require: 'options',

restrict: 'A',

link: function(_,element,__,options){

var selectors = someThirdPartyAPI();

element.query(selectors.join(','))

.forEach(e => options.apply(e));

}

};

}]);

21 of 41

@Directive({

selector: ['[blink]']

})

class Blink {

constructor(element:Element,

options:Options,

timeout:Timeout) {

...

}

}

22 of 41

class Directive {

selector:string;

constructor({selector:string}) {

this.selector = selector;

}

}

@Directive({

selector: ['[blink]']

})

class Blink {...}

23 of 41

Introspection

24 of 41

var type = Door;

var material =

type.annotations[0];

expect(material.type)

.toEqual('wood'])

var parameters =

type.parameters;

expect(parameters)

.toEqual([Lock]);

class Material {

type:string;

constructor(type) {

this.type = type;

}

}

class Lock {...}

@Material('wood')

class Door {

constructor(lock:Lock){

...

}

}

25 of 41

Expressive Code Needs

Types & Annotations

Introspections

26 of 41

Abstraction

27 of 41

Why is abstraction important

Language

  • Better language

Abstractions

  • Declarative
    • Angular
    • Dependency Injection�
  • Contracts
    • Types

28 of 41

These are not new ideas

29 of 41

ES3 '99

- try/catch

- RegExp

ES4 '07

- Types

- Classes

- Modules

- (other)

ES5 '09

- strict mode

ES6 '15

- Classes

- Modules�- (other)

ES? '??

- Types

- Annotation�- Introspection

30 of 41

AtScript

- Annotations

- Introspection

TypeScript

- Types

ES6

- classes

- modules

ES5

31 of 41

Evolution of Syntax

32 of 41

ES5

function Blink(element,

options,

timeout) {

}

Blink.annotations = [

new Directive({selector: '[blink]'})];

Blink.parameters = [

Element, Options, Timeout];

33 of 41

ES6

class Blink {

constructor(element,

options,

timeout) {

}

}

Blink.annotations = [

new Directive({selector: '[blink]'})];

Blink.parameters = [

Element, Options, Timeout];

34 of 41

TypeScript

class Blink {

public static annotations = [

new Directive({selector: '[blink]'})];

public static parameters = [

Element, Options, Timeout];

constructor(element:Element,

options:Options,

timeout:Timeout) { }

}

35 of 41

AtScript

@Directive({

selector: '[blink]'

})

class Blink {

constructor(element:Element,

options:Options,

timeout:Timeout) {

}

}

36 of 41

CoffeeScript

class Blink {

@annotations = [

new Directive({selector: '[blink]'})];

@parameters = [

Element, Options, Timeout];

constructor: (element, options, timeout){

}

}

37 of 41

Roadmap

38 of 41

AtScript

traceur

*.ats

*.es5

*.dart

39 of 41

AtScript to �*.js & *.dart

Runtime Type Checking

Static Type Checking

Align with TypeScript

IDE

support

Browser Support

EcmaScript Proposal

EcmaScript Standard

40 of 41

AtScript != new language

AtScript = ES6

+ Types

+ Annotations

+ Introspections

41 of 41