Hacker News new | ask | show | jobs
by pjmlp 52 days ago
Simulate was the word, not map 1:1 the exact experience.

It isn't pretty, but one can try to achieve a similar approach.

https://godbolt.org/z/TjPha3obs

Failing that, there are always Clojure, Kotlin and Scala on the JVM, which expose language features to achieve the same, which you naturally can mix and match with plain old Java.

1 comments

Why the reference to “modern Java” then? Writing adaptor classes is not “modern Java” nor does it involve using “a mix of interfaces and default methods implementations”.

I was responding to your original claim and I’m well aware of such facilities in both Kotlin and Scala - having used both extensively. I was genuinely curious if the latest Java was in the process of adding support for trait/typeclasses - so I don’t understand why you’d bother to reply with something that completely changes your original claim.