Live data from Hacker News

TypeScript Seals My Penchant for JavaScript

cycligent.com

81–90 of 133 posts

Re: TypeScript Seals My Penchant for JavaScript

#81
post #78
post #67

Earlier quoted context omitted.

> Well, if English were statically typed, the compiler would have caught your spelling mistake before you submitted your comment. Ha! I love seeing things like this on HN and think it's a perfect example to illustrate the power of static typing. Kudos!

I fail to see what typing and a typo have to do with each other to make that joke worthwhile.

> I fail to see what typing and a typo have to do with each other to make that joke worthwhile.

Well to be fair it's more about static analysis vs catching typos though they tend to go hand in hand. I suppose a more apt analogy would be transposing a letter in the sentence where it was still spelled corrected but the part of speech changed from a noun to a verb.

Re: TypeScript Seals My Penchant for JavaScript

#82
post #27

I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more p…

>> All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules...

Ah yes, let's blame the tool for the bad things people do with the tool.

Re: TypeScript Seals My Penchant for JavaScript

#83
post #71
post #27

I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more p…

For me, it's first class function support. Of course, there are other "real functional languages" like Scala, Haskel or whatever, but they very uncommon. JS is the only commonly (Clojure is very uncommon) used language with real first class functions and not some silly hack like Ruby/Python lamdas, procs, or blocks. To be fair, it seems that Java 8 has first class functions. I can't say much about it since I didn't g…

Java is a different best. It is used for a lot of enterprise projects but you don't want to use it on your own hobby projects. You can't get things done in time.

Re: TypeScript Seals My Penchant for JavaScript

#84
post #5

Earlier quoted context omitted.

But if you're going to transpile, why not transpile from a real language, not a Turing tarpit?

(1) The transpiled JavaScript closely resembles the source TS, making debugging easier (source maps allieviete this to a certain extent). (2) Transpiling from a whole different language means you have to port the standard runtime, otherwise you'd lose portability and familiarity, which are the two key advantages of transpiling from another, widely used language. Also, as JavaScript often runs in the browser this mean…

> The transpiled JavaScript closely resembles the source TS, making debugging easier (source maps allieviete this to a certain extent).

High-level languages look nothing like machine code, but we still compile them to it.

> Transpiling from a whole different language means you have to port the standard runtime

That's true, but it's not a reason not to use a good language instead of a horrific one.

> The more different the two languages are, the more likely you'll run into surprising situations where feature X in language Y cannot be implemented in its original form in JavaScript

I contend that any feature of a Turing-complete language can be implemented in JavaScript.

> As someone else mentioned, TS is almost a superset of JS, which means mixing in JS code into TS code is much easier.

'I still get to use JavaScript' doesn't sound very appealing. But, of course, many high-level languages offer an escape to assembler: a high-level language compiling to JavaScript can offer an escape to JavaScript.

> What is a real language anyway?

Haskell, CaML, Lisp, Python, Go — not JavaScript, though, which is an embarrassment to our profession.

Re: TypeScript Seals My Penchant for JavaScript

#85
post #27

I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more p…

Well you don't have much choice for frontend for one. Typescript offers much stronger typing than Ruby, Python, Clojure and PHP as well.

For me frontend == native, so I have plenty of choices.

Re: TypeScript Seals My Penchant for JavaScript

#86
post #56
post #27

I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more p…

Best thing about JavaScript is the speed of development. Once you master it, all other languages & ecosystems feel verbose, archaic. Modern JS (ES2015+) combined with a code style (Standard, Airbnb) is beautiful, sometimes more so than Python. Bad modules isn't a problem inherent to JS. NPM has its faults, but the JS community is the largest, and the fastest moving of all. Everything you need already exists, and it's…

I don't agree with this. For example I can get things done using Clojure incredibly fast. The development speed with it is simply unparalleled. And since they introduced clojure.spec you get the best of both worlds (static, typed / dynamic). Bad modules is not inherent to JS but it __is__ a problem currently. Compare it to Maven Central for example: scandals like the one happened with kik is simply impossible. What I see is that there are a lot of libraries in JS which are made obsolete within a few weeks when something new and shiny comes out but there is no depth to it. For example I had to develop a topological sorting algorithm for a frontend project and I did not want to implement my own Graph library so I picked one which had the most Stars. Needless to say that the asymptotic complexities of its operations were not documented and in the end it turned out, that an operation which was supposed to have an O(1) complexity had O(n) and the whole application blew up. The point is that most libraries are sloppy and you end up reimplementing something when all your options fail. I'm used to the Collections framework in java which is well documented and performs admirably. Another problem is that javascript carries a lot of baggage which is a result of the poor design of the language itself and you end up using a lot of transpilers which extremely slows down the compile process. An application reload for example in Clojure (if you use Mount) takes less than a second.

Re: TypeScript Seals My Penchant for JavaScript

#87
post #38

Earlier quoted context omitted.

Enterprise-level capabilities . I know the E-word is taboo here but aren't you people exaggerating a but on the trolling?

"Enterprise-level capabilities" doesn't mean anything still. Google is bigger than most enterprises, and they don't use any "enterprisey" stuff, not even in their Java.

Did you ever wrote Android or GWT code?

Re: TypeScript Seals My Penchant for JavaScript

#88
post #75

Earlier quoted context omitted.

How are they a hack in Python?

lambda bodies can only be a single expression

There is more to functional programing in python than lambda functions. Normal functions can be created and passed around.

Re: TypeScript Seals My Penchant for JavaScript

#89
post #88

Earlier quoted context omitted.

lambda bodies can only be a single expression

There is more to functional programing in python than lambda functions. Normal functions can be created and passed around.

Sure, but I think that is the point. You can do that, but its not as convenient and becomes harder to read. And besides, those are free functions you speak of, not closures. To emulate multi-line closures becomes even more obtuse.

Re: TypeScript Seals My Penchant for JavaScript

#90
post #82
post #27

I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more p…

>> All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules... Ah yes, let's blame the tool for the bad things people do with the tool.

It does not make a difference whether the language is bad or the tool is bad because if in this case npm is a de facto tool for the ecosystem you will have to use it. Same with java: it is not the language which is problematic but the "enterprise" projects which need all kinds of factories/builders/etc which make development incredibly slow.
Post reply on HN