Live data from Hacker News

Announcing TypeScript 0.9.1

blogs.msdn.com

71–80 of 116 posts

Re: Announcing TypeScript 0.9.1

#71

I haven't heard much about TypeScript since its original announce. Are any big projects using it? Does anybody have some commentary on their experience using it and where they think the project is going?

I started using it just to see what the experience was like. My conclusion is that it's brilliant. It makes refactoring a much speedier experience which you can now do without the fear that you might with a straight JS codebase.

A real aid to productivity in my opinion. And I love how you can turn up and down the typing as you see fit.

Re: Announcing TypeScript 0.9.1

#72
post #5

Earlier quoted context omitted.

My project isn't huge, but larger than it could have been using idiomatic javascript. The scoping with modules and the typing really helped since I'm familiar with C# and having "everything light up" in the IDE. Saved a ton of time letting a compiler catch things instead of writing tests. I tried coffee script, but found the copy/paste option for javascript that I have already written won me over.

Saved a ton of time letting a compiler catch things instead of writing tests. Types should never mean writing less tests :/

he's right, you can cover more code using integration tests with a static typed language, unit test are then testing the functionality of individual classes.

especially for testing return types as C for example you assign those.

In C it's more popular to write example code which uses the library, and the errors are spotted at compile time.

Re: Announcing TypeScript 0.9.1

#73
post #67

Earlier quoted context omitted.

Probably the single worst conclusion someone can arrive at regarding typing.

Rather than slate me, some constructive discussion would be nice. I'll go from my side: 1. Static type compiler verification saves tonnes of problems. Try managing a 2MLOC dynamically typed solution and you'll get what I mean. 2. Static typed languages are way easier to refactor as more metadata is available to the tooling. 3. Static typed code is easier to test. The type contract is available over the boundary betwe…

5 is not entirely correct. 6 is not true, serialisation in dynamic languages is correctly done with type definitions. 7 is not true at all, mainstream statically typed languages (like C) much more commonly overflow silently. Look at Python, there's no way to lose precision through arithmetic, as types get promoted on overflow correctly.

In general, C's type system is so weak as to be both useless and a hindrance.

Re: Announcing TypeScript 0.9.1

#74

I haven't heard much about TypeScript since its original announce. Are any big projects using it? Does anybody have some commentary on their experience using it and where they think the project is going?

Using it on some new functionality at http://rplan.co.uk, pretty pleased so far. The language is great, with some really neat features such as using interfaces for structural typing (http://en.wikipedia.org/wiki/Structural_typing) and declaring properties in the constructor definition. The ability to progressively type code is obviously quite nice too. Coding speed is typically quicker than JS because the compiler catches bugs that might take longer to surface (especially when integrating components.) Refactoring is also easier thanks to both the type system and tool support.

The compiler speed is OK (well, 0.9.0 wasn't, but 0.9.1 should be back to where it was before.) The main pain point is that we usually want to type any 3rd party JS we interface with (e.g. Angular, Backbone, Highcharts etc.) though https://github.com/borisyankov/DefinitelyTyped is helpful with this. No major complaints as of yet.

It's still perhaps too early to tell how long MS will be supporting it. Windows 8 has a JS interface which is comforting, but they could turn around and decide to stop development on it. That would be a great shame, but the code is open source, the compiler works well as of today, and the generated JS is readable enough that it can be edited.

We're slowly migrating over from Coffeescript.

Re: Announcing TypeScript 0.9.1

#75
post #67

Earlier quoted context omitted.

Probably the single worst conclusion someone can arrive at regarding typing.

Rather than slate me, some constructive discussion would be nice. I'll go from my side: 1. Static type compiler verification saves tonnes of problems. Try managing a 2MLOC dynamically typed solution and you'll get what I mean. 2. Static typed languages are way easier to refactor as more metadata is available to the tooling. 3. Static typed code is easier to test. The type contract is available over the boundary betwe…

C has very simple types and allows for untyped operations very easily. Say you cast some ptr of type void* to Foo*: at least in Python you would get a dynamic type error if the cast was incorrect; in C you are lucky if your program immediately crashes.

C has some static type safety, and virtually no run-time type safety. Java on the other hand, has a lot of static type safety, is completely memory safe (barring bugs in the implementation), and checks all coercions dynamically. Python has what Java has dynamically, and nothing statically, but it is still 10 times better than what C has!

Re: Announcing TypeScript 0.9.1

#78
post #67

Earlier quoted context omitted.

Probably the single worst conclusion someone can arrive at regarding typing.

Rather than slate me, some constructive discussion would be nice. I'll go from my side: 1. Static type compiler verification saves tonnes of problems. Try managing a 2MLOC dynamically typed solution and you'll get what I mean. 2. Static typed languages are way easier to refactor as more metadata is available to the tooling. 3. Static typed code is easier to test. The type contract is available over the boundary betwe…

My worst nightmare would be managing a 2MLOC inherited from a programmer who used void * as a convenience so it's a little surprising to hear this.

Re: Announcing TypeScript 0.9.1

#79
post #48

The problem with TypeScript is its requirement for definition files which are most of the time outdated. That makes it unusable in a real project where many JS libs live together. (not saying that's the case all the time)

No, it's not a problem. You don't need the definition files if you don't care about getting the supporting static typing on external libs.

It is completely doable to simply let the external libs call to be dynamic and guard your core code with static typing.

Re: Announcing TypeScript 0.9.1

#80
post #21

Am justing waiting for them to implement "await".

I think you might be waiting for awhile unfortunately. Implementing await would result in a lot of autogenerated code. Typescript is largely meant to be almost 1:1 with the Javascript it produces. Anders talks about that problem in this video: http://channel9.msdn.com/Events/Build/2013/9-006

One proposed alternative to await (for CoffeeScript) that is more one-to-one with the generated JavaScript: https://github.com/jashkenas/coffee-script/issues/2762
Post reply on HN