Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31636

Re: If java doesn't support operator overloading, how does String + concatenation work

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: If java doesn't support operator overloading, how does String + concatenation work
Date 2015-04-30 23:46 +0200
Message-ID <cqfm6fFfctoU1@mid.individual.net> (permalink)
References <3eceaed0-2cfa-4fac-89d6-23445a670f84@googlegroups.com> <mhths3$c00$1@dont-email.me>

Show all headers | View raw


On 30.04.2015 17:32, Eric Sosman wrote:

> (In a trivial sense, defining a new
> class or interface extends the `==' and `!=' and `?:' operators to
> apply to new reference types -- but that's a pretty weak "overload.")

I am not sure I agree here: for == and != it would be sufficient to be 
defined on (Object, Object) - there is no need for an overloaded version 
for each type and in fact I could not find indication in the JLS that 
there are overloaded versions let alone overloaded versions of the 
reference equality operator with different semantics.  With your 
argument each new type would create a ton of overloaded versions - for 
each combination of reference types that have an inheritance relationship.

see JLS Java SE 8 15.21.3
http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.21.3

Cheers

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

If java doesn't support operator overloading, how does String + concatenation work Ajay Paul <ajaykpaul@gmail.com> - 2015-04-30 07:10 -0700
  Re: If java doesn't support operator overloading, how does String + concatenation work Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-04-30 11:32 -0400
    Re: If java doesn't support operator overloading, how does String   + concatenation work Robert Klemme <shortcutter@googlemail.com> - 2015-04-30 23:46 +0200
  Re: If java doesn't support operator overloading, how does String + concatenation work v_borchert@despammed.com (Volker Borchert) - 2015-05-01 06:33 +0000

csiph-web