3 ms·
> most type systems add much more overhead to development than agility I think this is true to a certain extent, but with a language like JS, there is a lot mo
by lloyd-christmas 10y ago
> most type systems add much more overhead to development than agility
I think this is true to a certain extent, but with a language like JS, there is a lot more composition of generics than there is inheritance. I see:
add5toStuff<T extends {stuff: number}>(item: T): T;
drastically more than:
class X {}
class Y extends X {}
class Z extends Y {}
The latter is always a nightmare of fighting the compiler. The former is a breeze to deal with. Your type casting will be limited almost completely to IO.
- jeremiep 10y agoBoth styles still encourage a lot of mutability and complexity throughout the codebase. The vast majority of typed web codebases I've seen were exercises in Java Enterprise development of various degrees. Generics or not the time spent typing everything is not matched by the advantages of static typing. You'd get more robustness by managing complexity and state; I've spent far more time hunting down bugs that passed through the type-system and tests than fixing typos in dynamically typed languages.
- lloyd-christmas 10y ago> Both styles still encourage a lot of mutability and complexity throughout the codebase. > You'd get more robustness by managing complexity and state; The top function has a return value of T. That's not encouraging mutability. It's only mutable because JS pass by reference, which is irrelevant to static/dynamic. If you use the return value instead of the passed value, it's "effectively" immutable and is a great way of managing state.