Live data from Hacker News

TypeScript: a language for application-scale JavaScript development

typescriptlang.org

131–140 of 316 posts

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

#131
They added static typing to javascript, except you can still pass a number to a function that takes a string. In their example http://www.typescriptlang.org/Playground/ replace the

   new Greeter("World");
with

   new Greeter(5);
and it still works. What good is adding types to functions if they are ignored?

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

#132
post #57

Earlier quoted context omitted.

Javascript is dreadfull , and its flaws are counter productive and intolerable. It has good things like closures and first class functions , and that's it. Most of js developpers hate javascript , but are forced to work with it. So they dont care what they use as client language provided it gets the job done. few people cares about Javascript. most of the devs hate it. But the browser as dev plateform is a fact.

That is a sweeping condemnation of JavaScript that I've honestly never heard support for. JavaScript has quirks that people don't like, but it can be rather enjoyable to work with.

It sounds like a condemnation coming from 1998, when doing anything in the browser was painful and that was the only place JavaScript existed. I hated JavaScript in those days, too, but today is a very different world.

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

#133

What about debugging? Thats my biggest problem with coffeescript How do they map errors thrown in the browser, to TypeScript code? If this has things like classes and such, the relationship isnt always going to be 1:1 and debugging can become a nightmare. Part of what makes javascript so great is how easy it is to debug. All these "superset" languages that compile to javascript fail hard @ debug support usually

What's with the insta-downvotes whenever someone mentions Coffeescript's debugging issues? I am not an active Coffeescript developer, but I thought that debugging line-by-line was prohibitively difficult, especially in the browser. Has this changed? If not, why the animosity?

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

#134

They added static typing to javascript, except you can still pass a number to a function that takes a string. In their example http://www.typescriptlang.org/Playground/ replace the new Greeter("World"); with new Greeter(5); and it still works. What good is adding types to functions if they are ignored?

In the "Walkthrough: Types" example (as well as the "Classes" one), that gives me an error.

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

#135

Why does everyone want to take all the nice features of javascript, it being so loose and freeform and turn it into Java? I don't need interfaces and classes built into the language. That's why it's so powerful and lightweight. Prototypical! People keep making the same mistakes, if you let them. No thanks.

Because writing big apps in dynamic languages sucks (I say this writing primarily Python & JS)

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

#136

They added static typing to javascript, except you can still pass a number to a function that takes a string. In their example http://www.typescriptlang.org/Playground/ replace the new Greeter("World"); with new Greeter(5); and it still works. What good is adding types to functions if they are ignored?

TypeScript will not abort compilation, but it will give you a warning. In the playground, that would be the red squiggly line indicating an error.

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

#137

Earlier quoted context omitted.

I've made a lazy linq-like library for javascript in the past.. The problem i had was that the native array methods are rather fast while function calls (for moveNext) are quite slow, so i couldn't get a whole lot of speed out of it. Newer javascript engines might be sufficient to offset that though.

I tried to get around this by creating overloads of almost all methods when you are operating on an array. `each` for instance, has a standard implementation using moveNext, and then an array implementation using a fast for loop. In some cases you could even drop down to native function calls.

Sounds reasonable. Could be better timing now as well, what with server-side javascript having become popular. Good luck with the library!

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

#138

> The scope of a parameter, local variable, or local function declared within a function declaration (including a constructor, member function, or member accessor declaration) or function expression is the body of that function declaration or function expression. This thing claims to be meant for "application-scale" JavaScript, and yet doesn't repair even JavaScript's most notorious error? A suggestion to the authors…

Except then you would likely lose the attribute of being a superset of JavaScript.

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

#139
post #42

Very interesting. The Apache 2.0 Licence is comforting, makes it worth having a look. The docs are here for anyone interested in the spec: http://typescript.codeplex.com/documentation I like what they've done. Nothing too revolutionary, mostly adding static typing to Javascript without straying to far from the existing (or future) language or increasing the noise significantly. Here's some highlights: * Type inferenc…

Are you actually implying with the above example code that you can call a undefined "super" constructor on an interface and pass it the "balance" variable, which the interface's non-existent constructor would presumably match by name?
Post reply on HN