Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84976 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57422 invoked from network); 16 Mar 2015 03:06:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 03:06:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.174 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.174 mail-ob0-f174.google.com Received: from [209.85.214.174] ([209.85.214.174:35971] helo=mail-ob0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/DF-06614-6A846055 for ; Sun, 15 Mar 2015 22:06:14 -0500 Received: by obdfc2 with SMTP id fc2so26395665obd.3 for ; Sun, 15 Mar 2015 20:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=TjJjmxemPtaUZ67PJu+y+vcLV9fLtwAHhaARPzBt+7Y=; b=z7YGXLYQLBT4aIxHi2+voDgPdAyvOhtc6yNfpvQjTEOnKpMG/S1qOz9WD9zXF2/4pi U8GlUT1V3zOmZmfLoikeX/uUV0affUL4EmsVTe5ir8ksyKn4Fi8Lc7ccY8/flqD/GDhK dfoOy79yADmY/97Yq0GRmEFUlTCed1KpGP7PDER41ROY+Y4TGFF++F3L4tgZ35CBKHkF bUUNQKp2cvPmoIz8coWe0fNVRsZgtxp/NtWcAqRldV5zeZZ1YQQNcCSuhFpqvEfDI75u 407d6p4E5NjDBV+dNSnQfznZHxFf2qWN2eV1dr7e33iTcDT4qH7eYSaaQXGpbm6txOR7 bLEw== X-Received: by 10.202.79.210 with SMTP id d201mr7914708oib.97.1426475171489; Sun, 15 Mar 2015 20:06:11 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.58.2 with HTTP; Sun, 15 Mar 2015 20:05:31 -0700 (PDT) In-Reply-To: <55064508.6050206@eliw.com> References: <5504EF9D.1000707@gmail.com> <55064508.6050206@eliw.com> Date: Mon, 16 Mar 2015 12:05:31 +0900 X-Google-Sender-Auth: _cScahmKxbCsNtLjiPZTM4fo-ec Message-ID: To: Eli Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113d6b72e0b09805115f21bb Subject: Re: [PHP-DEV] [RFC][PRE-VOTE] In Operator From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113d6b72e0b09805115f21bb Content-Type: text/plain; charset=UTF-8 Hi all, On Mon, Mar 16, 2015 at 11:50 AM, Eli wrote: > On 3/14/15 10:34 PM, Stanislav Malyshev wrote: > > Hi! > > > I'd like to announce that I'll open the vote for the in operator later that day. > You can find the RFC here: https://wiki.php.net/rfc/in_operator > > I think this operator is unnecessary - we already have perfectly good > function that does the same. > > > Hello Stas ... a quick question for you: I understand why you said you > don't feel it's necessary. (Of course, there are millions of features we > have that aren't necessary, *grin*) > > But I'd like to know from your POV: Does this harm anything? > > Because from my own POV: I see some great benefits of this feature, and > my first thoughts were 'oooh'. The reasons mostly fall around cognitive > dissonance. Two cases in particular: > > 1. > > I feel that this syntax being proposed, much better matches the way that > we think through a problem in the first place. You don't have to take a > 'step back' when coding to refactor your thought process into a function. > So if I'm thinking about a problem I'm thinking (and typing as I go:) > > If we have a zebra in our zoo ... then do X > > I can now with this syntax, write code that directly matches the cognitive > process: > > if ($zebra in $zoo) {} > > Currently, I can speak for myself, I almost always find myself doing a > 'backup' step in coding. Because in this situation my process becomes: > > if ($zebra ... Oh wait, can't do that, need to use in_array > > if (in_array( ... Oh wait, what's the order of parameters again? dang it, > hit php.net or find a recent use. > > if (in_array($zebra,$zoo)) {} ... *shew* > > In the end, yes, you can argue that this is a small thing. But I believe > that the simpler cognitive path that one follows with this new syntax will > bring some great benefit to coders. > This is one of the issue what I'm trying to fix by this RFC. https://wiki.php.net/rfc/consistent_function_names This would be better fix for this issue. Note: I added parameter issue handling to the RFC. > > 2. > > Well it's really the same situation. But just that I'm very often dealing > with people 'new or newer to the language'. Professionally training them, > or Unofficial Training, mentoring, helping out ... seeing people at > conferences and talking with them, etc. > > And the newer people to the language often get tripped up on exactly these > kinds of things. Lowering that cognitive barrier to translating one's > thought, to code. I feel is going to be a benefit here. > > ... > > So back to my original question. I respect your opinion, so I'd like to > understand more. Is this just truly a case of "Eh, we have a function > already, this isn't necessary"? Or is there some actual harm you see > caused by it? Please support the RFC. Any help/support/improvement/suggestion is appreciated. As I wrote previously, I think it's not a right time adding this operator now at least. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a113d6b72e0b09805115f21bb--