Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: If java doesn't support operator overloading, how does String + concatenation work Date: Thu, 30 Apr 2015 23:46:53 +0200 Lines: 24 Message-ID: References: <3eceaed0-2cfa-4fac-89d6-23445a670f84@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net YYaAYTe7M8GrHoUMDppA1gi/ZaSzqBHsvz6byOLHwe/3Y4IpA= Cancel-Lock: sha1:16yfEoBkfqA5jbScIRCgmfajWFo= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:31636 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/