Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (604)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Operator overloading  (Read 4599 times)
0 Members and 1 Guest are viewing this topic.
Offline longino

Junior Devvie


Medals: 1



« Posted 2012-07-16 00:05:43 »

I know that this is discussed ever since Java was released, and every other week someone comes around with the brilliant idea: "What if Java had operator overloading?"

Well, I understand the reasons against it, but did people at Sun ever questioned them? I mean, at all? Because it seems odd that a bunch of smart people would simply accept such arbitrariness without saying anything.

Operator overloading is a must for mathematical code. I can totally understand why some wouldn't want to touch Java for games.

Was there ever a controversy about it?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #1 - Posted 2012-07-16 00:15:50 »

There was a controversy then, there is now, and long story short, whatever you think about it, Java's never going to have it.

I really don't see what operator overloading has to do with games.  The usual objection there is the costs associated with a managed runtime.

Offline longino

Junior Devvie


Medals: 1



« Reply #2 - Posted 2012-07-16 00:19:22 »

I really don't see what operator overloading has to do with games.

Everything, because you will use vectors and matrices a lot.

This simple feature makes Java very shitty for this type of application.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jonjava
« Reply #3 - Posted 2012-07-16 00:22:43 »

I hate operator overloading with a passion. Screw you C++.

@longino Just use a method.

Offline moogie

JGO Ninja


Medals: 15
Projects: 6
Exp: 10 years


Java games rock!


« Reply #4 - Posted 2012-07-16 00:40:08 »

If you are keen then you can always create a pre-processor for your code that translates your custom operators into legitimate java syntax (i.e. method calls etc)

You can even make it a plugin into your IDE so that it does the pre-processing step automatically.

Java4k RIP 2014
Offline longino

Junior Devvie


Medals: 1



« Reply #5 - Posted 2012-07-16 00:46:18 »

If you are keen then you can always create a pre-processor for your code that translates your custom operators into legitimate java syntax (i.e. method calls etc)

You can even make it a plugin into your IDE so that it does the pre-processing step automatically.

How about I don't do anything and just use a tool that does it for me, like, something other than Java?
Offline moogie

JGO Ninja


Medals: 15
Projects: 6
Exp: 10 years


Java games rock!


« Reply #6 - Posted 2012-07-16 00:48:21 »

What tool is that? I was not aware that one existed and that is why i suggested you make the tool your self... then others can benefit as well if they want operator overloading as well.

Java4k RIP 2014
Offline longino

Junior Devvie


Medals: 1



« Reply #7 - Posted 2012-07-16 00:48:45 »

What tool is that? I was not aware that one existed and that is why i suggested you make the tool your self... then others can benefit as well if they want operator overloading as well.

Visual Studio and C++ or C#.
Offline moogie

JGO Ninja


Medals: 15
Projects: 6
Exp: 10 years


Java games rock!


« Reply #8 - Posted 2012-07-16 00:53:00 »

um but that is because those languages support operating overloading explicitly.... java does not. If you want to emulate operating overloading so you can... as i have suggested. If the underlying language does not support a feature there is no other way than to make your own tools (or create your own java-syntax based language that that compiles into bytecode that can run on a JVM)

Java4k RIP 2014
Offline sproingie

JGO Kernel


Medals: 202



« Reply #9 - Posted 2012-07-16 02:23:26 »

Java's not going to get operator overloading and no amount of whinging is going to change that.  Live with it or use Scala.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Evil[1]
« Reply #10 - Posted 2012-07-16 08:50:42 »

Operator overloading is a must for mathematical code.

Nope, operator overloading is just convinience stuff.
90% of mathematical high performance code is written in Fortran without any operator overloading.

And even in C++ it's just nice for prototyping, but for performance, you do something other.
Working on SoA or AoS with unrolled loops and SSE optimizations.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #11 - Posted 2012-07-16 19:55:10 »

Reading the thread till this point: Bye then!  Smiley

Offline Roquen
« Reply #12 - Posted 2012-07-17 10:09:24 »

@Evil[1]: So I guess that Cray, IBM and Sun know nothing about high performance computing then.
Offline Evil[1]
« Reply #13 - Posted 2012-07-17 10:47:48 »

You guessed correctly.
Offline Evil[1]
« Reply #14 - Posted 2012-07-17 10:53:00 »

Okay... jokes aside. Cray is Tesla these days. IBM is the strongest FORTRAN player in the field. And Sun, no Sun never knew a shit about performance. And those Hadoop solutions on Cray... you exchanged throughput and scalability with performance. And what the f**k has this all to do with operator overloading? I just said, that for the real performance you don't use operator overloading but tight SSE loops.

Or so to say, if you do this, you are doing it wrong:

1  
for(int i = 0; i < count; i++) A[i] = B[i] + C[i];
Offline Roquen
« Reply #15 - Posted 2012-07-17 11:19:23 »

I meant: chapel = cray, X10 = ibm, fortress = sun.  Pretty much all attempts at a FORTRAN replacement include operator overloading.

Now, you're the one the brought up SoA vs. AoS.  Pretty much dead issue today isn't it?  Load is computation chain dependent SIMD ops have been adding horizontal ops.  Load is data intensive, then massively parallel processors.  Of course a non-issue here since we don't have structures, concrete arrays nor SIMD access.  Our only option is going to the gpu.

Now while it's true that algebraic operator overloading is pure sugar, many useful features are pure sugar and often separates useful languages from the, well, not so useful.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #16 - Posted 2012-07-17 18:30:34 »

Hell, Fortress has unicode operators.

HPC isn't really concerned with syntax.  They stuck with fortran all that time after all.
Offline Roquen
« Reply #17 - Posted 2012-07-17 19:19:55 »

WRT: Fortress.  I haven't looked at it in ages, but it seemed like "a" goal was to allow code that pretty much looked like LaTeX output.  Being a very long time Mathematica user, I have to say being able to write that code that looks like the equation is pretty awesome.  Many, many operators is very useful in a fair number of mathematical fields.

WRT: HPC not caring about syntax.  If you mean the non-programmers using existing libraries...then OK.  But how many programmers that know more than a few languages and have a few years of experience don't care about syntax or cringe at glaring holes in their set of languages?
Offline ags1

JGO Wizard


Medals: 75
Projects: 3
Exp: 5 years


Make code not war!


« Reply #18 - Posted 2012-07-17 22:16:19 »

I meant: chapel = cray, X10 = ibm, fortress = sun.  Pretty much all attempts at a FORTRAN replacement include operator overloading.

Now, you're the one the brought up SoA vs. AoS.  Pretty much dead issue today isn't it?  Load is computation chain dependent SIMD ops have been adding horizontal ops.  Load is data intensive, then massively parallel processors.  Of course a non-issue here since we don't have structures, concrete arrays nor SIMD access.  Our only option is going to the gpu.

Now while it's true that algebraic operator overloading is pure sugar, many useful features are pure sugar and often separates useful languages from the, well, not so useful.

Everything that is not assembly is sugar :-)

Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 841
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #19 - Posted 2012-07-17 23:05:30 »

Everything that is not assembly is sugar :-)
assembly is sugar for a hex editor / binary

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #20 - Posted 2012-07-18 03:34:37 »

A hex editor/binary is sugar for hardware on/off switches.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #21 - Posted 2012-07-18 03:55:13 »

Hardware on/off switches is sugar for a soldering iron.
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #22 - Posted 2012-07-18 03:59:30 »

Soldering iron is sugar for your mom.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #23 - Posted 2012-07-18 04:09:38 »

Your mom is sweet sweet sugar.
Online Jimmt
Global Moderator

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #24 - Posted 2012-07-18 10:21:12 »

And once again, we stray off topic. But you guys are hilarious.
Offline Evil[1]
« Reply #25 - Posted 2012-07-18 11:02:43 »

Sweet as sugar? Depends on the mom being MILF or not, me thinks...
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #26 - Posted 2012-07-18 13:49:35 »

Sweet as sugar? Depends on the mom being MILF or not, me thinks...

I'm a mother, and I'm offended.  persecutioncomplex

Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #27 - Posted 2012-07-18 18:47:45 »

BS, everyone knows there are no women on the internet Tongue
I mean, who would be so stupid as to put a computer that close to the kitchen sink?

Offline Sublixt

Senior Newbie





« Reply #28 - Posted 2012-07-18 18:53:33 »

Well that escalated quickly.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #29 - Posted 2012-07-18 19:10:24 »

BS, everyone knows there are no women on the internet Tongue
I mean, who would be so stupid as to put a computer that close to the kitchen sink?

You're right! It was too easy to figure out. I'll have to revise my methods.

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (27 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (96 views)
2014-12-08 04:46:31

JscottyBieshaar (56 views)
2014-12-05 12:39:02

SHC (72 views)
2014-12-03 16:27:13

CopyableCougar4 (74 views)
2014-11-29 21:32:03

toopeicgaming1999 (134 views)
2014-11-26 15:22:04

toopeicgaming1999 (125 views)
2014-11-26 15:20:36

toopeicgaming1999 (35 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!