News for hackers. Stuff that matters.
Re:Things I Was Wrong About: Types by marktangotango on Sunday September 27, 2020 @02:16PM (#24608819)
I agree with this 1000%. Projects (note not programs or individual source files!) are simply easier to grok (maintain, enhance, debug, refactor) with statically (and strongly) typed languages than dynamic IMO.

Five years ago when switching jobs I’d pursue “full stack” positions because I’d done a fair amount of front end dev in the past. No more, me personally, I’m backend all the way. Dynamic typing (vanilla js) is just harder; more time consuming more cognitive load, IMO.

Re:Things I Was Wrong About: Types by lolinder on Sunday September 27, 2020 @02:41PM (#24609081)
It's not perfect, but TypeScript goes a long way toward making frontend feel as safe as backend. You still have the potential for weird bugs when interacting with external JavaScript, but your internal code is pretty safe. Also, TypeScript's type system is impressively flexible, and I often find myself missing features (like unions) when working with other languages.
Re:Things I Was Wrong About: Types by MiroF on Sunday September 27, 2020 @04:42PM (#24609997)
> missing features (like unions) when working with other languages.

Which languages are missing unions? Off the top of my head, they exist in C/C++ and mypy python.

Re:Things I Was Wrong About: Types by a_humean on Sunday September 27, 2020 @05:43PM (#24610362)
Typescript allows you to have literal type discriminators in their unions, which combined with control flow based type narrowing of unions effectively gives you sum types. That is what he is talking about, because most mainstream langauges don't have sum types and you need to go to strongly typed functional langauges (haskell, scala, etc...) or modern strongly typed langauges such as Rust to get access to such features.
Re:Things I Was Wrong About: Types by lolinder on Monday September 28, 2020 @02:22PM (#24619735)
Yes, this. Sum types in most languages are approximated by something like kotlin's sealed classes. Sometimes you don't want to declare a whole new class hierarchy, you just want to say "this function can either return this or this".