Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: "equals" - a bad name? Date: Thu, 18 Aug 2016 22:05:44 -0400 Organization: Aioe.org NNTP Server Lines: 40 Message-ID: References: <0oebrbd0tt47sk8k6u7l0inkhd5p3j76kd@4ax.com> NNTP-Posting-Host: 7SK6yTFfqwlIPNBLl3l7Qg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:35405 On 8/18/2016 12:42 PM, Gene Wirchenko wrote: > On Thu, 18 Aug 2016 06:45:26 -0700, Roedy Green > wrote: >> On 13 Aug 2016 23:25:20 GMT, ram@zedat.fu-berlin.de (Stefan Ram) >> wrote: >> >>> »a == b« and »a.equals( b )« have two different meanings >>> in Java. Fairly enough, they are written in different >>> ways in Java. >> >> Some Forth philosophy here. They pronounce words in a special way. >> They got into the habit since so many methods/operators contain >> punctuation. >> >> e.g. ! is pronounced "store". @ is pronounced "fetch" >> >> Some possible conventions: >> >> == very equals >> == equalsequals >> == same >> == identical > > In PHP, == is not identical; that would be ===. I got bit on > this on a uni assignment. PHP object1==object2 is Java object1.equals(object2), but the PHP class can not override the functionality it is always all fields PHP object1===object2 is Java object1==object2 PHP simple1===simple2 is Java simple1==simple2 PHP simple1==simple2 does not have a Java equivalent as PHP is doing various type conversions to see if it is logical the same Arne