4 ms·
Yes, totally agree. It's the lack of statical type systems like this one that makes people hate them - for good reasons.
by valenterry 6y ago
Yes, totally agree. It's the lack of statical type systems like this one that makes people hate them - for good reasons.
- NOGDP 6y agoThese languages have far better type systems than languages like python or javascript, that's not a reason to hate them.
- valenterry 6y agoWe are talking about user experience here. In that regard, comparing python/javascript with Java/C++ is comparing apples with oranges.
- NOGDP 6y agoWe 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.
- nicoburns 6y agoYes, but I find that the user experience of writing Rust or Swift is closer to that of JS than C# and Java.
- NOGDP 6y agoWhy? 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.
- valenterry 6y agoFirst 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)
- NOGDP 6y agoYou can't 'think away' the additional complexity of lifetimes and the borrow checker though. It's something you have to understand and keep in mind. > 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. In my opinion, Java without type inference is fine - it's very minor issue, and there is a fairly limited scope of code that would actually benefit from type inference in terms of quality/readability. If you use a decent editor most of the redundant typing is auto-completed anyway. > 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. Eh, Rust traits are better than Java's interfaces, but you can implement multiple interfaces for your own objects in Java without any wrappers. The issue is extending external objects to support new interfaces. Plus, the point is to have correct code defined and checked at interface/trait boundaries, something JS doesn't do at all. > Better and less noisy error handling (looking at you Java, Go, C++ and most other languages) The error messages for Rust can be much more complex than Java, and are probably more complex on average, simply because it's a more complex language and type system. I would say the benefits of Java's type system far outweigh the imperfections and tiny costs when compared to a language like JS.
- valenterry 6y ago> You can't 'think away' the additional complexity of lifetimes and the borrow checker though Of course you can't. But the problem of lifetimes does not go away, not matter if you use statical or dynamic typing. However, in javascript this problem does not exist, so obviously that can't be compared to Rust. If you use Rust, then because you _need_ this for performance. > In my opinion, Java without type inference is fine Fair enough, but most people see that very different, hence the unhappiness. > Eh, Rust traits are better than Java's interfaces, but you can implement multiple interfaces for your own objects in Java without any wrappers. The issue is extending external objects to support new interfaces. That's exactly what I said or at least meant. :) > The error messages for Rust can be much more complex than Java No no, not the error messages that the rust compiler gives you. I'm talking about error handling that the developer does. > I would say the benefits of Java's type system far outweigh the imperfections and tiny costs when compared to a language like JS. I agree, but just because the benefits outweight the problems, that doesn't mean people will be frustrated by these problematic parts. And let's not call it imperfections. Java is _so_ far away from perfection, that just gives your post a sarcastic touch.