4 ms·
> Java has a faster release schedule to get features out sooner While still being behind on most features?
by troupo 11d ago
> Java has a faster release schedule to get features out sooner
While still being behind on most features?
- MBCook 11d agoTo misquote Bart Simpson: > Let me get this straight: we're behind the [other languages] and we're going to catch up to them by going slower than they are? Gotta go faster if you ever wanna catch up. However, Java is also purposefully slow. Everything is extremely considered. And while it means it takes a while before you get a feature it tends to be pretty good.
- za3faran 11d agoWhich features exactly? Java got exhaustive pattern matching before C# (through sealed interfaces), it has switch expressions, multi-line strings, green threads and structured concurrency, is getting value types, and even type classes in the work.
- joe_mwangi 11d agoTypeclasses caught me by surprise. Smart move by the java team.
- troupo 11d agoGranted, I havent' used either for a couple of years, so my knowledge is a little rusty. Yes, some of them are "just syntax sugar", but man oh man does it make C# such a pleasant language to work with. Used to work at a company which had services both in Java and C#, so some of Java's decisions or indecisions felt like pain points when switching between the two: - Proper IEnumerable with proper iterators that in turn enables Linq (but in general permeates everything and is insanely easy to use and build upon). E.g. building an async service that behaves like an IEnumerable? Implement two methods. Collection is halfway there, but I honestly cannot remember what was irking me about it in comparison to C#. - Properties. Yeah, yeah, sealed classes, records and all that. Often you still need plain old classes. - object initialisers. Which makes constructing anything a breeze. And on top of that you don't need manual .of methods for anything Colleciton-like if it'sa an IEnumerable. - extension methods. - named and optional arguments in functions - null coalescing operator - generics over primitive types (unless it was already implemented, I remember seeing a JEP about it) - async/await. Yes, I know: different approaches to concurrency and all that. A lot of unnecessary verbiage could still probably be hidden behind a friendlier syntax. - (sadly impossible in JVM to type erasure, only including this because I remember needing it many moons ago) generics metadata in runtime - .... definitely a bunch more I don't remember at this point ...
- za3faran 11d ago> Proper IEnumerable with proper iterators that in turn enables Linq Are you referring to generators? > Properties As far as I'm aware, it is a deliberate choice not to implement them, and I can see their point of view. > object initialisers I believe the same justification applies here, it's mainly syntactic sugar, and can result in certain undesired behavior by bypassing constructors where validation can happen. > extension methods Typeclasses are currently being explored, which are a superior approach. > named and optional arguments in functions Those would be nice (at least named arguments). I can see how optional arguments could complicate things. > generics over primitive types As you mentioned, it's in the works > async/await... verbiage could still probably be hidden behind a friendlier syntax The approach they took does not need any extra syntax.
- troupo 10d ago> Are you referring to generators? Both I guess. Main thing is https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1?view=net-10.0 https://learn.microsoft.com/en-us/dotnet/api/system.collecti... which seems to be everywhere in the language and the library. > I believe the same justification applies here, it's mainly syntactic sugar, and can result in certain undesired behavior by bypassing constructors where validation can happen. This is mostly due language design. Java heavily relies on properties and provides no facilities for them. Hence the builder pattern instead of object initializers. In C# object initializers synergize with properties: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers https://learn.microsoft.com/en-us/dotnet/csharp/programming-... > The approach they took does not need any extra syntax. You mean it needs 15 lines whete C# needs one? ;)
- za3faran 10d ago> You mean it needs 15 lines whete C# needs one? ;) Can you elaborate? The async/await approach is much more than 1 line when you need to switch a call between them. Whereas the green thread approach does not need anything.
- jayd16 10d agoEven in the small list of features in your retort you had to switch to future tense.
- za3faran 10d agoValue types are scheduled to be in preview next release (6 months). And C# does not have type classes.