Hacker News new | past | comments | ask | show | jobs | submit login

> I'm simply pointing out that most statically typed languages, the most used ones especially, don't particularly benefit from static typing

That's an opinion presented as fact. You are outright discounting the opposing view. That's why you're being downvoted, not because anyone is being emotional.

Some benefits:

- performance. compiler can make huge optimizations if it knows the types.

- refactoring. changing functions might change data expected in another function. you could remedy this with unit tests, or just use static typing.

- onboarding. new developers on a project, regardless of experience, don't "layout the types in their head", static typing helps.




[flagged]


> I know people are irrational, especially when they feel that their beliefs are being questioned.

do you think I haven't used dynamic languages? I started using elixir in 2016. I started my career in Ruby, JS, and PHP.

Just because you can conceptualize the entire codebase's type system in your big brain, doesn't mean other don't have a rational reason for preferring static typing.

> Did you have this problem recently?

Every time I refactor, my dude.


> in many statically typed languages this involves bitwise operators, lots of boilerplate, and mental hoops to adapt to an API 50 years old.

Bitstring in OCaml: https://bitstring.software/

Just as simple as in Erlang.

> I know for a fact that static typed languages don't help that much.

How do you know this?

> We all know that static typed languages are harder to learn and master

Again–how do you know this?

> Erlang has int (arbitrary length, like in real life) and floats. It is definitely easier.

OCaml has int and float, simple.

> We've all seen companies like Github, Twitter, Airbnb, born because Ruby on Rails exists.

These companies are now using Haskell, Scala, TypeScript.

> Facebook was written in PHP.

Fb created Hack, a statically-typed language that compiles to PHP. It has at least two other static-typing language compilers.

> Rust creates incredibly fast code, it has an incredibly slow compiler.

Is this proving something?

> Did you have this problem recently?

Yes–I and many others have this problem constantly, because we are mostly paid to work on existing codebases, not throwaway scripts.

> Of course the answer is "this is the programmers fault", but if it's wrong, why is it allowed?

Why is it allowed in dynamically-typed languages? Because it's useful. Same reason.

> Types are harder to understand and to correctly plan ahead for.

Types are not unchangeable; the whole point is that you can safely change code that has a typing discipline.

> it takes a great programmer to use types correctly in a way that others will comprehend without prior knowledge of the domain.

Then it must take an incredible programmer to maintain a dynamically-typed codebase.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: