Interesting proposals: Java 9 and beyond

I really really really miss operator overloads

What’s up with this scope stuff then? What’s it for?

Cas :slight_smile:

I really really really don’t.

If they would be introduced, I guess you won’t be forced to use them…

Better have choice

I’d be forced to read them.

Operators that followed normal Java identifier convention would do me just fine eg.


   vec3 a, b;
   float dp = a dot b;

Value types will be a bit of a failure without the ability to define operators for them.

Cas :slight_smile:

well if I am understanding this right, value types are going to be or allow stack allocation, so it will not be a failure in places where people are squeezing the performance out of anywhere they can; most likely none of us will need it.

op overload will open another hell for java EE. … would be awesome tho’ :slight_smile:

If only for value classes (aka structs)… This is very, very good idea.

Otherwise, I don’t agree.

Any mention of stack allocation and value types in the same sentence makes me wonder whether they’re going to design what we actually need or whether they’re just going to go off on one and make something almost but not quite entirely wrong.

Cas :slight_smile:

What else could it be for?

If operator overloading would be possible for “normal” classes as well, I am sure that this possibility would be abused a lot: things like events/setters done with overloaded “+” operator and similar code smells.

That’s why actual operator overloading should be banned… but the principle of adding a new syntax to allow methods to be defined as operators seems to have few reasonable arguments against.

Cas :slight_smile:

I personally wouldn’t like that. Allowing functions to be defined as operators would merely be syntactic sugar. And it doesn’t do much to improve code readability.

Besides, functions can already be used as operators. lwjgl-util and glm and joml all have sub(), dot(), cross(), negate() and other methods which are basically mathematical operations for vectors and matrices. There’s no need for us to define new operators, is there?

But that’s just my opinion.

I want


class A extends B,C,D{
}

and i don’t care how linker link code - with JVM or source code cloning
i feel like in stone age - when i creating duplicate for same class - because JVM can’t link 2+ classes with data :frowning:

No, you have totally missed the point :slight_smile: Operators is all about readability and syntactic sugar. sub(), dot() etc are all hideous to behold and don’t scan properly. If you disagree with me, then LISP. I win.

Cas :slight_smile:

“If you disagree with me, then LISP"? What does that mean?

LISP is a fantastic language where everything is an s-expression and most people’s brain’s explode at that point. Sugar that makes code faster and easier to read is what most people want. For mathematical expressions having operators makes the code read closer to the math. Somewhere ages ago I did an example of a trivial mathematical expression with and without operators.

When I was a student I had a rant at a prof that showed me his “image processing library” code which used lots and lots operators like: [icode]A=B*C[/icode] Insanely stupid right? Except the target audience wasn’t production code…it was for students taking class where the reasoning was about math on images.

LISP is both the ultimate programming language and the ultimate failure. It’s like a perfection so beautiful it unfortunately instantly blinds you permanently if you behold it.

Cas :slight_smile:

I love LISP. “Absence makes the heart grow fonder.” The last time we got together we tried to kill each other.