operator overloading : Java Glossary


operator overloading

Java does not let you overload operators with new meaning, e.g. to define + for the Complex class. Neither does it allow you to add your own new operators e.g. -> for input and <- for output. However, André van Delft of subscript-lange.org has invented a preprocessor that lets you add new operators of the form .< .<. and <.

Consider languages that allow you no overload + for example to have many other meanings.

The problem with that is when you have code mixing ordinary plus and overloaded plus. To understand the code you have to decode it to figure out which operator is intended. This is not something you can do when skimming.

On the other hand overloading is a rich metaphor than helps simplify the syntax. For example, compare a complex library implemented with overloaded operators to one with methods.

I think the way to resolve this is to take advantage of the fact we are no longer limited to ASCII (American Standard Code for Information Interchange) teletypes. There are glyphs and fonts and colours that look similar to ordinary plus, but which are easy to tell apart. Let your IDE/SCID to do the visual decoding for you so you can easily tell all the overloaded variants apart at a glance.

This page is posted
on the web at:


Optional Replicator mirror
of mindprod.com
on local hard disk J:

Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number