News for hackers. Stuff that matters.
Re:Node.js and the new web front-end by Kiro on Monday October 07, 2013 @04:24PM (#6510988)
What's so good about TypeScript's type system and what problem does it solve?
Re:Node.js and the new web front-end by ilaksh on Tuesday October 08, 2013 @12:43AM (#6513092)
Almost no one realizes this, but the main purpose of TypeScript is to negate one of JavaScript's greatest advantages which is the lack of typing. This is an advantage because it makes code easier to write and read.

The problem that TypeScript solves is that the web platform is in direct conflict with Microsoft's monopolies in PC gaming and business productivity software (Office). Confusing developers into thinking that JavaScript needs types leads them down the path of statically typed languages, i.e. C# and Microsoft's proprietary and closed .NET Framework and software ecosystem.

Re:Node.js and the new web front-end by drifkin on Tuesday October 08, 2013 @04:56AM (#6513688)
I think optional typing is better than no typing. It's useful for allowing APIs to be self documenting. It seems as if optional typing is going to get more and more popular. For example, see Google's optional typing in dart, where they actually recommend to not use types for local variables:

https://www.dartlang.org/articles/style-guide/#type-annotati...

Re:Node.js and the new web front-end by ilaksh on Tuesday October 08, 2013 @07:22AM (#6514100)
I am not sure. I think that descriptive identifiers can indicate the type and be augmented by documentation.
Re:Node.js and the new web front-end by lmm on Tuesday October 08, 2013 @08:55AM (#6514483)
They can. But both tend to get out of date as a codebase develops. It's very useful to have an automated tool that ensures the documentation lines up with the actual code - i.e. a type checker.
Re:Node.js and the new web front-end by CmonDev on Tuesday October 08, 2013 @05:45AM (#6513828)
The "Open Web" is closed to one single language choice that was made for you by someone else. TypeScript is being developed, because Microsoft adapts to where the world is moving and they are just trying to avert the disaster that will happen when enterprises will actually start trying developing whole applications in JS. And Google is developing a higher-order version language as well. Nobody developed a language to run on top of Java, C#, C++, but there is a plenty of choice for JS: Dart, TypeScript, CoffeeScript etc.
Re:Node.js and the new web front-end by dragonwriter on Tuesday October 08, 2013 @12:29PM (#6516031)
> Nobody developed a language to run on top of Java, C#, C++

Because instead of developing languages to run on top of them, people just designed languages to run on the same platform. The browser environment is a special case where the only common feature of the platform that is available to target is JS, there's no common VM underlying it, so replacements target JS.

Though its worth noting that while it may be true that no one developed a language to run on top of C++, C++ was originally implemented as a language that was preprocessed into C and then fed to a C compiler, much the way that many JS alternatives are compiled to JS and then fed to a JS interpreter.

Re:Node.js and the new web front-end by joshuacc on Tuesday October 08, 2013 @09:55AM (#6514886)
> Nobody developed a language to run on top of Java

Clojure? Scala?

Re:Node.js and the new web front-end by CmonDev on Wednesday October 09, 2013 @04:05AM (#6519942)
I said 'Java' not JVM.
Re:Node.js and the new web front-end by bovermyer on Tuesday October 08, 2013 @12:20PM (#6515975)
Dart runs on top of JS? I thought it was a replacement for JS.
Re:Node.js and the new web front-end by dragonwriter on Tuesday October 08, 2013 @12:25PM (#6516012)
The primary mechanism for running Dart on the client is by compilation to JS. There is a DartVM that runs Dart directly, but its not bundled into any browsers except for a special version of Chromium ("Dartium") bundled with the Dart SDK so that the development cycle can proceed without a dart2js run at each iteration, but its not intended for general use that way.
Re:Node.js and the new web front-end by 10098 on Tuesday October 08, 2013 @06:40AM (#6513989)
Holy mother of god, HOW is untyped code easier to read?!
Re:Node.js and the new web front-end by zcrar70 on Monday October 07, 2013 @06:56PM (#6511882)
the two best features of Typescript's type system IMHO are:

- structural typing for interfaces (which means that classes implicitly implement an interface if the definitions match)

- gradual typing (mainly the ability to convert between 'any' and other types implicitly, which makes it much easier to interact with JS libraries/port JS code to Typescript.)

More generally speaking, Typescript aims to solve the problem of maintaining large codebases by giving you the additional security of static typing. The idea is that many simple errors can often be caught by a compiler, but would be much more time-consuming to find otherwise.

Re:Node.js and the new web front-end by tracker1 on Wednesday October 09, 2013 @03:27AM (#6519854)
JS already has this..

if (obj && obj.quack && typeof obj.quack == 'function') obj.quack(); //looks like a duck

Re:Node.js and the new web front-end by 727374 on Monday October 07, 2013 @05:40PM (#6511479)
In general, I believe it will help make larger JS codebases more maintainable. Specifically it enhances the following:

- Refactoring e.g. easily globally change a class member's name

- Type safety e.g. it will bark if you pass a string where an int is expected

- General IDE handyness e.g. 'Go to definition'

A really good demo here: http://channel9.msdn.com/Events/Build/2013/3-314

Re:Node.js and the new web front-end by 10098 on Monday October 07, 2013 @04:55PM (#6511200)
Problems like I look at a function and have no clue about what it's arguments are.
Re:Node.js and the new web front-end by tracker1 on Wednesday October 09, 2013 @03:26AM (#6519850)
JSDoc comments?