Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84204 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21198 invoked from network); 2 Mar 2015 23:10:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2015 23:10:59 -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.192.45 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.192.45 mail-qg0-f45.google.com Received: from [209.85.192.45] ([209.85.192.45:55433] helo=mail-qg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/D3-14834-20EE4F45 for ; Mon, 02 Mar 2015 18:10:58 -0500 Received: by mail-qg0-f45.google.com with SMTP id z107so7827878qgd.4 for ; Mon, 02 Mar 2015 15:10:55 -0800 (PST) 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=GnnvVFk8O595k92axEEAhNcML7Bl3sq5zowmmY4N0YA=; b=IFV9gKUy43Tx2sXP723NGt7AcPUMIesFHDqttwYtY2fX5EqjRIzeaRDy4s2QmvONMI JIO9T4WPdjd7kB8CLwgIsmFiBn9q4robpQE6y14FewX8wNI6SzkRhQOdept+nQnNG8T2 9A9T/BcOnfxw6nVG3ihfYsidXQLvsv/bOgeX1p4XYQNyiUm60T7Vk293zQtQuf7lroy3 3vrXWaLpYbeTEy81NmFNgjxB0rD4rDzZwd8IzKzbi8cnTlVivJ603c/1LBa4AU6YEEDG FA/GX5xG21AWcaN43MOX/xXYvWn/94p/akvqJsi+/iRxfn3O8F+BjH0eNrcgvJy+PC2v d3Mw== X-Received: by 10.140.31.116 with SMTP id e107mr27373188qge.36.1425337855506; Mon, 02 Mar 2015 15:10:55 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.198.8 with HTTP; Mon, 2 Mar 2015 15:10:15 -0800 (PST) In-Reply-To: <54F4EBEC.2090702@garfieldtech.com> References: <54F4E29D.7080501@garfieldtech.com> <54F4E93C.80206@gmail.com> <54F4EBEC.2090702@garfieldtech.com> Date: Tue, 3 Mar 2015 08:10:15 +0900 X-Google-Sender-Auth: QxUa39R0iGI2VqdO9ReCCr8ReAA Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113a9544901f8505105654e5 Subject: Re: [PHP-DEV] Consistent function names From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113a9544901f8505105654e5 Content-Type: text/plain; charset=UTF-8 Hi Larry, On Tue, Mar 3, 2015 at 8:02 AM, Larry Garfield wrote: > On 3/2/15 4:50 PM, Rowan Collins wrote: > >> On 02/03/2015 22:36, Yasuo Ohgaki wrote: >> >>> I like scalar objects, but it does not resolve that PHP has non standard >>> function names. >>> It does not change old names, therefore it's impossible to resolve issue. >>> This is the reason why I'm proposing while I like scalar object, use of >>> namespace, etc. >>> >> >> Again, you're contradicting yourself here - you can't say that your >> mission is to change the old names, rather than offer an alternative, >> but then also say that the old names will stay around forever. If both >> names exist, that's exactly what you've created - an alternative. >> >> If we're going to have an alternative, let's come up with a creative >> alternative that actually has an advantage to using it, not a choice >> between equally cryptic names like "strripos" vs "str_ripos". >> >> Regards, >> > > Exactly. If a PHP 7 dev has the option of: > > $s = strripos($s, 'a'); // works in PHP 5+ > > $s = str_ripos($s, 'a'); // works in PHP 7+ > > Really, what's the advantage of the latter? Nothing. It's an extra > character to type, limits compatibility, and makes my life no easier. It's > useless, and will just add to the list of things people make fun of PHP for > instead of reduce it. > > Namespacing it is no better: > > $s = str\ripos($s, 'a'); // Still useless > $s = php\str_ripos($s, 'a'); // Still useless > > > Instead, compare: > > $s = strripos($s, 'a'); // works in PHP 5+ > > $s = $s->lastOccurance('a', 0, CASE_INSENSITIVE); // works in PHP 7+ > > Oh now we're talking! That's more self-documenting, easier to discover, > makes chaining string manipulations easier to read, solves the > needle/haystack issue, and reduces cholesterol. > > One is worth the effort of doing. The other is simply not. > > For subsystems that aren't clear scalars, like streams, those need a > general overhaul for DX, too. Again, just doubling the number of function > names adds nothing to the language but confusion, since both versions would > have to live for at least the next decade. Offering a substantially better > alternative does improve the language. Don't waste your time on marginal > not-even-improvements. I would love to have new & clean APIs. Please think my proposal as legacy API cleanups. Many of candidates will remain without CORDING_STANDARSDS confirmed names almost forever. This is what I would like to improve. If you don't care about legacy stuff cleanups, please don't care. The cleanups will not hurt anything, almost. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a113a9544901f8505105654e5--