Live data from Hacker News

TypeScript: a language for application-scale JavaScript development

typescriptlang.org

81–90 of 316 posts

Re: TypeScript: a language for application-scale JavaScript development

#81
post #15

I've written a lot of JavaScript, including large-scale projects, and never once have thought, "Gee, I wish I had type checking." Haven't we come to a consensus that types are more trouble than they're worth? They hurt clarity and catch few bugs.

Not really, i love JavaScript but do think types have their place in documenting the code and in supporting tooling (e.g. Refactoring).

Re: TypeScript: a language for application-scale JavaScript development

#82
post #37

Earlier quoted context omitted.

I like the shortened function form. I played around with CS for a while before going back to JS, but I do miss being able to do something like: var names = people.map((p) -> return p.name); (or something along those lines). Funnily enough, it reminds me of C#'s LINQ: var names = people.Select(p => p.name);

I've written a LINQ style library for TypeScript that allows you to write something like this: from([1,2,3]).select(n => n * n).where(n >=2).toArray() which outputs [4, 9] Hoping to open source it soon. Edit: typo, n * 2 should have been n * n, sorry for the confusion

Have you used the popular library Underscore.js http://underscorejs.org/? The equivalent to your code in Underscore would be:

    _.chain([1,2,3]).map(n => n * n).filter(n => n >= 2).value()

Re: TypeScript: a language for application-scale JavaScript development

#83
This is quite impressive technically, and I think the type-checking feature alone can make it appeal to those making large-scale application in collaborative development environment. I hope this inspires other similar efforts. A quick run-down of features:

- It's a superset of JavaScript. So there is no porting effort needed. (With CoffeeScript, you do not need to port if you don't want to.)

- compile-time type checking, like type erasure in Java's generics.

- module support at the language level. It's very thin. It does not give your AMD or CommonJS module, but you can easily hack around it.

- class and inheritance support at the language level. The implementation is very similar to CoffeeScript's.

Re: TypeScript: a language for application-scale JavaScript development

#84

This seems similar to the type checking and optimization done by Google Closure Compiler?

The main difference is that the Closure compiler compiles JS->JS, keeping all the type info in jsdoc comments. Typescript makes the typing a first class language entity, which reduces code portability (and toolchain flexibility) in favor of (I assume) readability and maintainabilty.

Another huge advantage is that the typescript parser & compiler is written in Javascript. Closure's jscomp is Java, which decreases backend portability somewhat.

Re: TypeScript: a language for application-scale JavaScript development

#86

All of these compile-to-JS efforts are great, and as much as I love things like CoffeeScript I have to say I definitely worry about language fragmentation. JavaScript is full of flaws, but its monopoly in the browser space has brought about one intriguing and welcome side-effect: a VERY efficient market for both employers and employees. It's easy to overlook how important this common denominator has been for everyone…

I think you were referring to the JavaScript syntax when you said JavaScript is full of flaws, because IMHO the language itself - except the syntax component - is actually very good. Someone on Quora said[1] it very well: JavaScript is a wonderful language, deep down: It's Lisp-y, yet imperative. Its lack of support for threads has turned out to be a strength on the server side. And recent implementations have made i…

The intrinsic beauty of JavaScript doesn't matter in this context. Either you use JavaScript or you use something else, and if you use something else then that'll lead to language fragmentation, which is arturadib's concern.

Re: TypeScript: a language for application-scale JavaScript development

#87
post #68

$ t command not found clearly they could have named the compiler just 't' instead of the overly verbose 'tsc'. all those extra characters!!

The compilers for C# and F# are named csc and fsc, respectively. I think we can handle two extra characters. ;)

Re: TypeScript: a language for application-scale JavaScript development

#88
post #73

Earlier quoted context omitted.

Nonetheless, interesting disclaimer text spotted there. Raises a good question... would that text be there because somebody in the industry analyzes your code?

Are we reading the same thing? Code is not sent to Microsoft.

Exactly. But if one clearly states that, perhaps there are others in the industry that do the oposite, iaw analyzing / scraping / calling home some code.

Having that disclaimer makes them safe in case someone might notice that insert IDE / online editor here does that and rings the bell.

Re: TypeScript: a language for application-scale JavaScript development

#89
post #4

Say what you want about whether this is a good idea or not, it is clear at least part of MS is really serious about open source. * TypeScript is under the Apache 2.0 license [1] * Source is available via git on Codeplex [2] * Installation is as easy as npm install -g typescript [3] Extra bonus coolness: They've provided an online playground like jsfiddle! [4]. [1] http://typescript.codeplex.com/license [2] http://typ…

I started doing C# development last year, coming from mostly a Unix/Perl platform, and I'm really glad about the timing because that's when Microsoft got serious about open development. I started doing web apps using ASP.NET MVC3, and this year MVC4 was released as an open-source project[1]. It seems that a bunch of 'young turks' have reached higher management positions in most of the key software development products within Microsoft and they're all pushing for this kind of open source approach.

[1] http://aspnet.codeplex.com/

Re: TypeScript: a language for application-scale JavaScript development

#90
post #80

All of these compile-to-JS efforts are great, and as much as I love things like CoffeeScript I have to say I definitely worry about language fragmentation. JavaScript is full of flaws, but its monopoly in the browser space has brought about one intriguing and welcome side-effect: a VERY efficient market for both employers and employees. It's easy to overlook how important this common denominator has been for everyone…

[deleted]

[deleted]
Post reply on HN