Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by saagarjha on Saturday March 04, 2023 @03:04AM
(#35019144)
There is exactly one good reason against operator overloading, and that’s operator<<. People are mostly sane otherwise and it’s a good thing to have.
[ Parent
| on HN ]
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by kaba0 on Saturday March 04, 2023 @03:19AM
(#35019214)
Arbitrary overloading can be problematic, like !#< or whatever is quite hard to look up (scala, haskell), but I agree that implementing an interface/trait that will give you that syntactic sugar is mostly okay (like Rust, e.g. implements Add would give you + operator).
Re:JEP 430: String Templates (Preview) Proposed to Target Ja...
by vips7L on Saturday March 04, 2023 @07:39AM
(#35020377)
I remember working in some scala that used akka actors and seeing ! for the first time. Something like:
actor ! someData
It was just an operator to send the data to the actor. A named function would have been so much better.