News for hackers. Stuff that matters.
Re:Nuances of Overloading and Overriding in Java by invalidname on Thursday May 18, 2023 @02:38PM (#35992256)
Are these things HN readers didn't know?

I didn't know you can do operator overloading in Java (with Manifold). That would be interesting: https://www.youtube.com/watch?v=pwQs-308OdY

Re:Nuances of Overloading and Overriding in Java by nilptr on Thursday May 18, 2023 @03:38PM (#35993004)
I would be terrified on introducing that into a project and worrying about its long-term support...
Re:Nuances of Overloading and Overriding in Java by Twisol on Thursday May 18, 2023 @06:48PM (#35995321)
A team I was on decided against Manifold precisely because we wanted to keep up with Java's twice-yearly version updates, and we didn't want a bespoke compiler plugin to lock us to an older version.

I think Manifold is extremely cool, and it does look like they're keeping up with the latest -- but the deep compiler magic it relies on really makes me nervous.

Re:Nuances of Overloading and Overriding in Java by zeedude on Thursday May 18, 2023 @10:26PM (#35997065)
They are good about supporting latest JDK release and all LTS releases, going back to 8.

It’s Oracle’s saber rattling lately concerning plugins like Lombok and Manifold that make me more disappointed than nervous.

Re:Nuances of Overloading and Overriding in Java by whartung on Friday May 19, 2023 @12:59AM (#35997947)
What rattling is that?
Re:Nuances of Overloading and Overriding in Java by Twisol on Friday May 19, 2023 @04:08PM (#36006283)
Yes, exactly -- the responsibility to keep up with Java versions does not, unfortunately, lie with Manifold alone. The deep magic they rely on also needs to remain accessible.
Re:Nuances of Overloading and Overriding in Java by invalidname on Thursday May 18, 2023 @10:22PM (#35997033)
It is interesting through ;-)

Personally, I will probably introduce some of it to a project I'm working on. Here's why:

* It's relatively conservative - almost of all its work is done in compile time. Once you have a binary and it went through testing then Manifold is irrelevant.

* It's open source - I know it's not the same as "support" but the project has been around for a while and the author is active.

* Worst case scenario I can remove it - it would suck since I will need to rewrite code. But the compiler will point me at the exact lines of code I need to fix.

Re:Nuances of Overloading and Overriding in Java by tpoacher on Saturday May 20, 2023 @11:51AM (#36012930)
I was not aware of manifold; from a quick look, my understanding is that manifold is a bunch of popular language extensions, implemented mostly via preprocessor annotations, which are highly tied to specific java versions and IDEs.

But while that does seem cool, I'd hesitate to call manifold-driven operator overloading as "modern java supporting op overloading". To me it has the same vibe as simulating high-level syntax in c via hacky macros.

Re:Nuances of Overloading and Overriding in Java by invalidname on Saturday May 20, 2023 @12:03PM (#36013038)
That's not how it works exactly. It's a deep integration as a compiler plugin extension. It works with LTS versions since 8 and with Java 19 (I think 20 also works but not sure).

Modern Java is the title of the series that talks about many different subjects including new Java language features, etc.

Re:Nuances of Overloading and Overriding in Java by tpoacher on Saturday May 20, 2023 @02:08PM (#36014182)
As in, the java compiler formally provides extension APIs, and Manifold taps directly into those?

Hm, ok, in that case, slightly less hacky. Probably more comparable to using gcc extensions then... in that, I'd still hesitate to call it "this is evidence that c supports x" ... but it's the kind of statement that could be argued both ways, and discussions would probably quickly devolve into semantics and pedantry rather than anything of practical significance.

Re:Nuances of Overloading and Overriding in Java by invalidname on Saturday May 20, 2023 @02:11PM (#36014211)
Yes. I suggest checking out the full project source: https://github.com/manifold-systems/manifold

It's very impressive and far bigger than the operator overloading stuff. The other videos in that series cover some of the other features.