Live data from Hacker News

Angular 2: Built on TypeScript

blogs.msdn.com

151–160 of 235 posts

Re: Angular 2: Built on TypeScript

#152
post #75
post #60

Earlier quoted context omitted.

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…

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.

Re: Angular 2: Built on TypeScript

#153
post #118

Embrace, extend, extinguish.

To extinguish, you introduce incompatibilities to make the life of people outside your inner ecosystem (compared to the greater, standard-compliant ecosystem) harder. But since TypeScript compiles to JavaScript and interfaces with plain JavaScript wells, there is really no "extinguish" part here. Also, the EEE accusation doesn't really apply to open source projects. EEE is bad since after the proprietary product supe…

to be fair typescript isnt compatible with es6 right now.

Re: Angular 2: Built on TypeScript

#154
post #60

Earlier quoted context omitted.

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…

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.

Re: Angular 2: Built on TypeScript

#155
post #94

Earlier quoted context omitted.

> Transpiling may actually be the safest way to use JavaScript, especially given its rate of change. [..] A transpiler allows you to use these features now without any worry. I disagree and my original statement applies as much to TypeScript as it does to an ECMAScript 6 transpiler. If you want to use the new features and you're transpiling now you need to have a good understanding of the differences between ECMAScri…

I feel more comfortable writing TypeScript rather than using an ES6 transpiler, really. The compiler is built really well - you can observe the team's development process on github and I have to say the level is quite impressive (extensive code reviews and great discussions on the issue tracker).

I'm sure the compiler is well built but stability is my main concern. JavaScript, even with its many flaws, is used by millions of people every day and is one of the most used programming languages in existence. That's a ton of testing through real world use. Since transpilers just compile to JavaScript, they can take advantage of some of the same stability of JavaScript for its output but the act of transpiling is only used by maybe a few thousand users. Sure they'll find bugs and fix them but that's nowhere near the same level as simply writing in native JavaScript (native JavaScript, is that an oxymoron? lol).

Besides all that everything ever created has bugs; why risk introducing bugs from a JavaScript engine and from a transpiler when you can risk a single one?

As an aside my first and last time using CoffeeScript I ran into an issue that, since this was about two years ago, has already been fixed but at the time it cost me hours of debugging time. It really soured my experience with any transpiler.

Re: Angular 2: Built on TypeScript

#156

Angular 2 is having a lot of pushback and challenges, but this may be a positive. First, there have been hard feelings over breaking backward compatibility. To rub salt in the wound the new syntax doesn't seem to buy you much for many basic scenarios. If you are going to push big breaking changes you need to show big benefits that are easy to understand at a glance. Secondly, the Ember community started small but has…

The typescript move is more along the lines of "we had these extensions to typescript we were calling AtScript, but now they're included in the forthcoming release of TypeScript, so we'll just call it Typescript". It doesn't seem to actually change any on-the-ground syntax, just what you call the language.

another, more important piece (IMO) of response to the pushback they've been getting came during the new router demo at ng-conf today. Apparently, you'll be able to mix-and-match ng2 and ng1 routes within the same router, so the commitment was: if you use the new router, there's a clear incremental upgrade path as you port parts of your app to ng2.

I'm still in wait-and-see mode, but there's apparently also talk (from the same router talk) of tools to convert ui-router built routers to the new router, which would be double-rad.

https://www.youtube.com/watch?v=vecg70fPDFw (the router talk in question)

Re: Angular 2: Built on TypeScript

#158

As if we didn't have enough reason to move on from Angular. Now you need to learn Typescript to contribute or grok the source files?

This is the main reason why I don't like using languages that transpile into JavaScript. I don't mind the languages themselves but transpiling into JavaScript now means you have to be effective in both languages instead of one to properly debug and you're also subjected to bugs that may or may not be known in the transpile itself. Everyone seems to hate on JavaScript but it's really not that bad to use.

Have you actually tried TypeScript? It feels just like writing JavaScript, but with a thin layer of type annotations that bring you the familiar advantages of static typing.

It seems to me that JavaScript haters would be better off moving to a completely different language, like ClojureScript. TypeScript rather feels like it's made for people who enjoy JavaScript but wish it provided the peace of mind of static typing.

I tried TypeScript for the first time a few months ago and it was a breeze. I felt "fluent" almost instantly and only had to look up the docs a few times. With ES6+ picking up steam, TypeScript-specific features are being replaced by their ES6+ equivalent, so TypeScript is going to feel even more natural going forward.

Re: Angular 2: Built on TypeScript

#159
Looking at the example source code & having experience of AngularJs & TS, I would say this is a huge development in term of enterprise adoption.

Statically typed, annotations, built-in dependency injection, comprehensive test support (easy to write testable code), declarative UIs, 100s of already available libraries & above all support from Google and Microsoft. I can say this with confidence that even with a complete rewrite & not backward compatible, AngularJS 2 with TS is going to be a huge success for everyone.

And sooner or later, all other frameworks will adopt ECMA Script 6 because of standardisation of so many things (modules, classes etc.)

I would also like to add that this is a very exciting time for JavaScript developers because there are so many things happening & companies of all sizes will keep investing good amount of money moderating their JS code bases.

Re: Angular 2: Built on TypeScript

#160
post #134

Earlier quoted context omitted.

> How in the world does this man keep up with all these projects? He needs to write a book on motivation. By dumping them mid-way and getting to the next shiny one? Anybody knows how this RoR kickstarter project finally went?

coldtea, you just got served.

[deleted]
Post reply on HN