Hacker News new | ask | show | jobs
by valenterry 2050 days ago
Yes, totally agree. It's the lack of statical type systems like this one that makes people hate them - for good reasons.
1 comments

These languages have far better type systems than languages like python or javascript, that's not a reason to hate them.
We are talking about user experience here. In that regard, comparing python/javascript with Java/C++ is comparing apples with oranges.
We are talking about Python and JavaScript from the top of this comment chain, and the 'user experience' of writing Java/C# is closer to Python and JavaScript than to, say, Haskell.
Yes, but I find that the user experience of writing Rust or Swift is closer to that of JS than C# and Java.
Why? Rust's type system is basically a more sophisticated version of Java's, JS is in the opposite direction - a much simpler dynamic type system. Rust's lifetimes and borrow checker is additional complexity that JS doesn't have. Rust has longer compilation times than JS, longer than Java. Etc.
>Why? Rust's type system is basically a more sophisticated version of Java's, JS is in the opposite direction - a much simpler dynamic type system.

I would argue that a sophisticated type system is closer to dynamic typing than a simple type system. A type system is like guard rails that prevent you from doing certain things. A sophisticated type system gives you more freedom and possibilities than a simple type system, and hence is closer to a dynamic type system without the guard rails at all.

First of all, of course Rust hast some additional complexity because it is close to bare metal. But if you think this complexity away (to make it comparable to e.g. javascript), here are some reasons:

1) Better type-inference. In Java this has improved but is still much more clunky and boilerplatey. Good type-inference is important to not annoy the user.

2) Traits / type-classes. They enable a way of programming that comes much closer to duck-typing and avoid wrapping your objects in wrapper-classes to support interfaces like you are forced to do it in Java.

3) Better and less noisy error handling (looking at you Java, Go, C++ and most other languages)