3 ms·
Could you be more specific? How is it really annoying to define new types in Java?
by AnimalMuppet 11y ago
Could you be more specific? How is it really annoying to define new types in Java?
- SamReidHughes 11y agoYou have to manually define its constructor, manually provide getters if you want the value to be immutable, put each class in a separate file (or namespaced inside another class), and if your type has finitely many alternatives you have to set up the whole visitor pattern thing. Compare that with C#'s properties and readonly, Scala's case classes, Swift's enum types.
- bcg1 11y agoMaking immutable structures in Java truly does suck... this is the most valid complaint that I've heard in a long time about the language. It would be extremely easy to implement properties as syntactic sugar in the language or via built-in annotations without changing the class file spec at all.