Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61414 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18808 invoked from network); 18 Jul 2012 16:45:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2012 16:45:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:42454] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/D0-39169-E28E6005 for ; Wed, 18 Jul 2012 12:45:35 -0400 Received: by yhoo21 with SMTP id o21so2033294yho.29 for ; Wed, 18 Jul 2012 09:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+woeDKhpSb4eQU3E0rJIPG8RZKmigtPwiPC4mHJSJAc=; b=C6lPRZfTSQTHCgELlHtNV9GBwo3odYRVUDm1zhEKFcIQb8dPGEQvyu0wq0p4js/VL6 awjFZLEA1kYnMOV/o6Pp2bAJ5c+TxAK8/M8BSmcRtlW5LCwKl9jSIHDgNxFFNLalS9RU IjW8kUMtxmvhuzjjXEpgKais4wScTKzhE0YNFr/bubWqJxLAwFPPbchUUaZQLrBt5L1X n9ZTJzxR/O075UcWoL0Y/weJ8CUysHYS6IvsyCOT+GSLMMKA1gKebtgavZ9J7ErNeGNK K/LoLQ3taj/dAghmzMM1c//psQxQChgnSc17VOlmSdr55dD+DDculBemC8i4ytsADApu KCkA== MIME-Version: 1.0 Received: by 10.50.36.131 with SMTP id q3mr1963588igj.56.1342629930482; Wed, 18 Jul 2012 09:45:30 -0700 (PDT) Received: by 10.231.134.9 with HTTP; Wed, 18 Jul 2012 09:45:30 -0700 (PDT) In-Reply-To: <5006E5BB.50906@sugarcrm.com> References: <50059AF8.5050805@sugarcrm.com> <5005CB58.2020601@sugarcrm.com> <50066724.6050901@sugarcrm.com> <50067040.3090307@sugarcrm.com> <5006E5BB.50906@sugarcrm.com> Date: Wed, 18 Jul 2012 18:45:30 +0200 Message-ID: To: Stas Malyshev Cc: Andrew Faulds , internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: pierre.php@gmail.com (Pierre Joye) hi Stas, On Wed, Jul 18, 2012 at 6:35 PM, Stas Malyshev wrote: > Hi! > >> enough but I don't know the Zend engine well enough). This way we can >> have array->key, array->sort(TYPE), etc. for new code to use, instead of >> the legacy array and string method mess (the latter needs a cleanup more >> in particular). > > The mess does not exist because we have array_key() instead of > array->key(). There's nothing wrong with having array_key(). The mess > exists because functions do not form single API with single principle > behind it, but were added in ad-hoc manner, sometimes without > correlating them with others. So, if you want to clean it up, you'd want > to write a plan how new API would look like and how it will be better > than old one. If the solution is "let's use ->" then it's not worth it. > The solution that's worth it is "let's have this better API" and that's > where we should start, not with changing array_key() to array->key() and > saying "now we have clean sexy API". > Please let me refresh the psat years history of PHP releases. Any attempt to change any kind of function signatures in the core has been rejected for obvious reasons (BC breaks, useless code changes, etc. etc.). So I won't spend a single second to try to propose to rewamp or duplicate functions for the sake of making the signature more consistent with each other, or cleaner. On the hand, this solution allows that, right away, without BC breaks and brings us to the (very) long term goal (actual object for standard types, like in other languages). Now you can totally disregard the benefit of this (purely vaporware right now) solution, but to keep saying that this argument is pointless is not going to bring us any step further, really not. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org