Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is the relationship between the upcoming TypeScript 2.0 and ES6? Are they trying to achieve parity or keep evolving as a superset of standard JS?


Both?

"In addition to the type system improvements, one of the main goals for the upcoming TypeScript 2.0 release is to fully support the ECMAScript 6 standard. With TypeScript 1.4, we take another step towards this goal. In this release, we’ve added a new ES6 output mode, support for let and const, and support for ES6 template strings."


There will never be "types" in javascript,at most something like "guards" or runtime assertion checking, but they will never implement typescript type system. It's too late for that.


I'm not so sure about that. Microsoft, Google, and Facebook have all implemented pretty similar typed supersets of JavaScript (TypeScript, AtScript and Flow). At least in Google's case, they are intentionally keeping AtScript similar to TypeScript in the hopes of influencing ES7. I expect that Microsoft and Facebook have similar ambitions.


EcmaScript 4 had a type system. Although ES4 never quite made it to browsers, there certainly was enough interest to standardize a type system in ES4. Microsoft is a part of "they" at ECMA determining the ES standard and it is certainly within the realm of possibility that if TypeScript proves people want it, a TypeScript-like type system could indeed become standard in some future EcmaScript edition. In some ways, TypeScript is Microsoft's playground for things that they would like to see eventually become standard.


Indeed we had structural types in ES4 toward the end, and almost bluffed MS into folding (I'm told by a reliable source). But ES4 was trying for too much too soon.

At this point we really need to see ES6/7 and TypeScript + Flow "gene-culture co-evolution". As I said at the last TC39 meeting on the topic, big de-facto standard wins trump rushed de-jure standards any day.

/be


I don't understand the Flow "gene culture co-evolution" part. What do yo mean by that?


Google works, first hit for "gene-culture co-evolution" is

http://en.wikipedia.org/wiki/Dual_inheritance_theory.

The analogy is

* core JS standard = genes, DNA in full (mitochondrial [asm.js? :-P] and nuclear [dynamically typed JS]);

* Flow, TS, TS* and other research = culture.

Obviously it's a loose analogy, not an identity. There's no "Red Queen" (sex, sexual selection), but we do definitely see selection over time via developer adoption, what wins on performance and ergonomics, what feeds back from the ecosystem into the core standard APIs.

Also even a few new special forms: generators in ES6 (prototyped in ES4) were inspired by many experiments; mainly they constitute introgression from Python 2.5+.

JS as an evolutionary kernel (http://www.cc.gatech.edu/~sakhshab/evoarch-extended.pdf) consists of almost totally conserved material (always extended, backward compatibility required for adoption by developers and competing browsers), only slowly extended, while diverse languages and frameworks evolve above and below -- Node.js 14 years after I put JS in Netscape 2, e.g.

Feedback goes both ways, especially in the post-ES3 era where Firefox brought the browser market back to life. See ECMA-262 later editions (the Harmony era) rolling up de-facto standards such as Array map/reduce/forEach/etc.

The same feedback could and should happen with a standardized type system of some sort. It won't happen via design by committee, or picking one winner too soon.

Type system implementors and the JS stewards must communicate well for this to win. It's looking good so far, on Ecma TC39: JQuery, Facebook, Netflix, PayPal (Ebay originally, and again), Twitter all represented along with Apple, Google, Microsoft, and Mozilla. Also academic researchers from various universities, all of whom love type systems and theory :-).

/be


Masterfully applied analogy. Thank you.


It's also worthwhile to remember that gradually typed languages is /still/ an active research area (MSR has several people working on it, including around ES/TS, and there were adverts for sponsored PhDs around gradual typing in ES/TS around a year ago). I think it's still a bit early to burn something into the standard (once something ships, it'll be near impossible to ever remove; this is probably partly a reaction to ES4 which built a lot on fairly recent and ongoing research, arguably leading to its downfall), but I also think it's a direction most people within the committee want the language to take.


"Never" is a long time... there's rumblings in the ES Discuss notes about "Type Annotations" https://esdiscuss.org/notes/2014-09-25.


Most of the JS runtimes already do some kind of type inference and checking in the JIT pipeline so providing those hints ahead of time is technically feasible.


> Most of the JS runtimes already do some kind of type inference

Problem is they are not available to users. I dont care what the JIT does,I want my IDE to help me write correct code,that's the goal of Typescript.


Its not too late, gradual typing can still be added. Maybe in ES7 or ES8.




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

Search: