Live data from Hacker News

Ask HN: Changing my mind about JavaScript

news.ycombinator.com

31–40 of 73 posts

Re: Ask HN: Changing my mind about JavaScript

#31
post #19

Static types are sanity when the people and years keep increasing. It isn't at all important in small one man projects since most of your defined types are in your head in any case. There is nothing wrong with JavaScript as a language beyond it's, originally questionable, foundations that have since been iterated upon (much like PHP). As a massive fan of static typed languages. There is no denying that dynamic typed…

I often hear people say this, but in my opinion, static types save a ton of trial and error and help you out even for a 20 LoC script.

Re: Ask HN: Changing my mind about JavaScript

#32
post #19

Static types are sanity when the people and years keep increasing. It isn't at all important in small one man projects since most of your defined types are in your head in any case. There is nothing wrong with JavaScript as a language beyond it's, originally questionable, foundations that have since been iterated upon (much like PHP). As a massive fan of static typed languages. There is no denying that dynamic typed…

"It isn't at all important in small one man projects since most of your defined types are in your head in any case."

Yes, today. Not in 7 days, let alone 3 months.

Re: Ask HN: Changing my mind about JavaScript

#33

My (unpopular?) take is that JavaScript should suffice. Once I feel the need for TypeScript, I've done something wrong. For example, built my whole frontend with JavaScript or built my backend in JavaScript. JavaScript's use case for me is sprinkling it where needed in browser. Anything extra and it feels wrong tool for the job. Frankly, I believe whole existence of TypeScript is a mistake – we should've never used J…

How would you not build the whole frontend in JS though? Use another compile-to-JS language?

[deleted]

Re: Ask HN: Changing my mind about JavaScript

#35
post #3

I have used many languages in my nearly 40 years as a programmer (Scheme, C++, Java, Python, Haskell, OCaml, Rust, etc.) and still enjoy JavaScript: It’s decent as a language and there is so much you can do with it. Tips: • If you like static typing, you’ll want to use TypeScript. It’s more work to set up, but it catches many bugs, especially subtle ones where JavaScript’s semantics are not intuitive. • I learned a l…

> If you like static typing, you’ll want to use TypeScript. It’s more work to set up, but it catches many bugs, especially subtle ones where JavaScript’s semantics are not intuitive.

It’s worth looking at JSDoc as an alternative to regular TypeScript. No compiler to set up, and you’re restricted in a good way - less likely to get over-engineered types.

Re: Ask HN: Changing my mind about JavaScript

#36
post #32
post #19

Static types are sanity when the people and years keep increasing. It isn't at all important in small one man projects since most of your defined types are in your head in any case. There is nothing wrong with JavaScript as a language beyond it's, originally questionable, foundations that have since been iterated upon (much like PHP). As a massive fan of static typed languages. There is no denying that dynamic typed…

"It isn't at all important in small one man projects since most of your defined types are in your head in any case." Yes, today. Not in 7 days, let alone 3 months.

And if you are working on multiple projects as a freelancer, the brain capacity it occupies seriously hampers productivity.

We are creating software to make people more productive, but when it comes to our own productivity many of us interestingly shy away from using software (types, in this case) to enhance our own.

I did this mistake for years. Cost me dearly.

Re: Ask HN: Changing my mind about JavaScript

#37
post #17
post #9

I mean why not use Typescript and have both? Projects don't have to become very large at all before static types are better & more productive than dynamic types. Especially for multi-person projects, or ones that last for a while so you forget stuff.

agree with this, at this point all my toy projects, even those of a few lines, are in typescript (with bun.js so I don't have the overhead of configuring node for ts)

Yeah I use Deno for the same reason.

Re: Ask HN: Changing my mind about JavaScript

#38
The industry uses TypeScript these days. If you’re inheriting a project, write the new stuff in TS, and gradually migrate. If you’re using the modern syntax, I’d say JS behaves mostly like every other language, with the exception being the tooling landscape is massive

Re: Ask HN: Changing my mind about JavaScript

#39

My (unpopular?) take is that JavaScript should suffice. Once I feel the need for TypeScript, I've done something wrong. For example, built my whole frontend with JavaScript or built my backend in JavaScript. JavaScript's use case for me is sprinkling it where needed in browser. Anything extra and it feels wrong tool for the job. Frankly, I believe whole existence of TypeScript is a mistake – we should've never used J…

How would you not build the whole frontend in JS though? Use another compile-to-JS language?

Render most of the frontend server-side and just use JavaScript for the dynamic bits only, I guess? I personally haven't done it like this since the advent of SPAs, but I'm guessing lots of things are still built like this.

Re: Ask HN: Changing my mind about JavaScript

#40
post #13

There's JavaScript The Good Parts by Douglas Crockford. I've read the book and watched a similar series on YouTube.

This book was excellent for the time, but is now quite outdated. Stuff like how he proposes modules is completely irrelevant with ES modules, arrow functions make ‘this’ much easier, and we have block scoped bindings
Post reply on HN