HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

Link 12435 thumbnail
User 107114 avatar

By daniel
via cafe.elharo.com
Published: Jan 31 2007 / 18:08

The gates seem to be open for serious revisions to the Java language in Java 7. Thus it’s worth reviewing why some things are just flat out bad ideas for any language, because too many developers either never knew this or have forgotten it. First up: operator overloading:
  • 7
  • 0
  • 1731
  • 1

Comments

Add your comment
User 201715 avatar

boo_radley replied ago:

2 votes Vote down Vote up Reply

Reasoning seems to be "I can't imagine why this would be useful and I don't trust the people I work with who might use this". Not exactly solid logic there, champ. And for the examples (matrices, database records), I'd expect that when the operation couldn't apply, that the operation would -- wait for it -- throw an exception, or return some variation of NaN.

User 201715 avatar

boo_radley replied ago:

1 votes Vote down Vote up Reply

Also, "Considered Harmful" is no longer clever.

User 187417 avatar

sproketboy replied ago:

0 votes Vote down Vote up Reply

It *is* harmful in that it obfuscates the intent of the code.

What does

Customer c1 = getCustomer();
Customer c2 = getCustomer();

Customer c3 = c1 + c2;

mean?

User 201715 avatar

boo_radley replied ago:

0 votes Vote down Vote up Reply

Are you dense? You don't have to apply operator overloading to every situation. What would it ever mean to "add two customers"? If it doesn't make sense conceptually, why would you expect it to make sense practically?

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (0)