Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98101 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52234 invoked from network); 31 Jan 2017 23:02:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 23:02:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.175 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 74.125.82.175 mail-ot0-f175.google.com Received: from [74.125.82.175] ([74.125.82.175:36489] helo=mail-ot0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/8E-51557-27711985 for ; Tue, 31 Jan 2017 18:02:11 -0500 Received: by mail-ot0-f175.google.com with SMTP id 32so119019747oth.3 for ; Tue, 31 Jan 2017 15:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HBpB+j2jtSaggGsEBx9sQfsDeNBzHTsW6vHeIL4HXdM=; b=n698cvGU6Kn901Ws3TfDQqALCSsyI0JKvBTKw3qLob3nM52EUWSrYj0pZD4YdX1BB9 cUCo3EZxXBSFRTf8yeNl4qRBVfFIRxoTTzpwCsCb9ZFeoqc83ia2BQ3hXpWQxmjLT450 rRHU5baWVPk87RL4xRhaaJOKUTZOousqOT9TNKLIt+ZLMc+F4jhLVNus3KjAZw0J1Ly6 7eSSMtzC8hpxXRtmosLscmGHStIEfmFenz06N7z0aAXXz2GCIk6aMsMWiH08RwW6AQsg rm42S1ob6c8Qv7d5+q6P6sBQ14mnp3L0Zjtqk1LOQBVLTkHyUcIZJgeJnd/wrh8srUmS fjhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HBpB+j2jtSaggGsEBx9sQfsDeNBzHTsW6vHeIL4HXdM=; b=uIr7lV+r/nYX1AOWnSkaQ4HGUT19Q2XgQfACwn8Gs/mwBRH55MdnRQoVCb9C/2BMF2 bA+WTcjNaUCrFqUtuz2fkjMCQt1zVp4xbOTiUw71UeHgua0QeG2h286MULIKTvdSFqCW E/AdMl43koykhQEq4TdD+GgtG08X5bcO14mV7czDCLQ8VBGSdSnqSn9m8TcJTIy8TO9+ d67g6snfb/rY3I6ddpcTtNOjb2NIE+N+7corauZHvpU85xz30ruwDBR9ch/8jdbCFaJM PA3/eHMtb2unxaqMs6JyifrsOpnZRkGimIp9uhnrHHz32ChEIUpU2fzZE+Cxr+oLxT6K +NuQ== X-Gm-Message-State: AIkVDXIYsgrlZ2iWr42Z0TAP8DwNVlvOg89Vi8AHpLwyWlCgizrxYFgbG8AL8dw1IbraNY4z6fnjRm2krYHKSg== X-Received: by 10.157.8.13 with SMTP id 13mr15983987oty.173.1485903727570; Tue, 31 Jan 2017 15:02:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.43.143 with HTTP; Tue, 31 Jan 2017 15:02:07 -0800 (PST) In-Reply-To: References: Date: Tue, 31 Jan 2017 16:02:07 -0700 Message-ID: To: "internals@lists.php.net" Cc: Adam Harvey Content-Type: multipart/alternative; boundary=94eb2c034ca6da509105476beb23 Subject: Re: [PHP-DEV] [RFC] Comparable From: derokorian@gmail.com (Ryan Pallas) --94eb2c034ca6da509105476beb23 Content-Type: text/plain; charset=UTF-8 On Tue, Jan 31, 2017 at 3:48 PM, Fleshgrinder wrote: > Hi :) > > I have a few questions regarding the comparable RFC: > > https://wiki.php.net/rfc/comparable > > Couldn't find the thread in my history and thus cannot respond directly > to any of the past threads. Maybe not that bad after more than a year of > silence. :) > > My question might sound silly but I am genuinely interested in the > explanation: why `compareTo` and not `comparedTo` as method name? Is it > simply because of Java? To me it sounds kind of wrong: > > if ($this->compareTo($other) === -1) { } > > Especially if we add a nice Ordering Enum with some real behavior to the > game: > > if ($this->compareTo($other)->isLess()) { } > > Compare this to: > > if ($this->comparedTo($other)->isLess()) { } > > This gets close to what I would understand as proper English. Then again > there might be valid reasons for the former name that I am not aware of?!? > I would say compareTo makes sense, because that's what you're asking the method to do. Methods aren't usually past tense as it would seem weird. Think about PDOStatement::fetch vs fetched, Exception::getMessage vs gotMessage. Honestly I can't think of a single example of a past tense method off the top of my head (doesn't meant they don't exist!). Even functions and language constructs are present (echo, require, print). > > There are other things that I think should be added along with this RFC. > However, I need to investigate a bit further first before going into > detail here. > > -- > Richard "Fleshgrinder" Fussenegger > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c034ca6da509105476beb23--