Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84419 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42627 invoked from network); 7 Mar 2015 23:31:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 23:31:54 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:45819] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/D0-34956-86A8BF45 for ; Sat, 07 Mar 2015 18:31:53 -0500 Received: by wggx13 with SMTP id x13so20104125wgg.12 for ; Sat, 07 Mar 2015 15:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to:cc :message-id; bh=Bequc8rwz/vcq5oDRZtbjLZObIulePRz5MJV7pual+Q=; b=bdE9n9X7+MxGAWhSNteiDHeHQo6/kYc4XhLmu3zQu6n2AE19SXFuqFUQzJpfZ7+hLB KksU6fmIj81X7ny+nzCKnr6ubWkrC+v19qivdd1nLqkyLgdy1ljr0lCaInYUbgnikRah 6KqC9dBfUJKpy59mKevXHu7QucsETWye9Ba8Gjh3GY87YbkfZcukNcIfPfCvpxhkn+ug onYB6zw6g1EDv5qAL+GHwenkgJx8+LgM3pu+twqFH0fIqwiOnJ/MFpQulADv8oiV0T9L eaYVaa8Ew95UTWjSMiutnGk6iFP5b5bt3Kw3nymqdypFJyAx6GyYl8D9ATNtBGaqOSbm 424A== X-Received: by 10.195.12.167 with SMTP id er7mr44455885wjd.54.1425771109799; Sat, 07 Mar 2015 15:31:49 -0800 (PST) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id jy7sm40520675wid.22.2015.03.07.15.31.48 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Mar 2015 15:31:49 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: References: <54F83061.60108@seld.be> <54FB44EE.6000704@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Sat, 07 Mar 2015 23:31:43 +0000 To: Yasuo Ohgaki CC: "internals@lists.php.net" Message-ID: <6805F3C6-E73F-4A00-A94A-FE38B7E6D90F@gmail.com> Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Consistent Function Names From: rowan.collins@gmail.com (Rowan Collins) On 7 March 2015 22:47:48 GMT, Yasuo Ohgaki wrote: >Hi Rowan, > >On Sun, Mar 8, 2015 at 3:35 AM, Rowan Collins >wrote: > >> On 06/03/2015 23:03, Yasuo Ohgaki wrote: >> >>> We have a lot of array_u*() functions such as >>> >>> http://php.net/manual/en/function.array-uintersect-uassoc.php >>> array array_uintersect_uassoc ( array $array1 , array $array2 [, >array >>> $... >>> ], callable $value_compare_func , callable $key_compare_func ) >>> this can be consolidated to >>> http://php.net/manual/en/function.array-intersect-assoc.php >>> array array_intersect_assoc ( array $array1 , array $array2 [, array >$... >>> ] >>> ) >>> >>> All of these has callback the end of parameters. These may be >>> consolidated. >>> I'll add this to the RFC if this is preferred. >>> >> >> Those functions both take any number of arguments, so given a >function >> call with 4 arguments, you can't know if that's 4 arrays, or 2 arrays >and 2 >> callbacks. Don't forget that array($class_name, $method_name) is a >valid >> callback, so you can't judge it by the type of the arguments either. > > >Thank you for heads up. If I detect array($class_name, $method_name) as >callback, there could >be unintended callback calls. > >Since we have been deprecated similar >call_user_method()/call_user_method_array(), we may >deprecate array callbacks for u* functions, then consolidate in the >future, >perhaps PHP8. >I don't mind add this to the RFC. What? That's not the same thing at all. I'm pretty sure those functions are deprecated *because* we have array callback forms, so you can use call_user_func to call a method. PHP has a well-defined definition of "callable", as used by is_callable() and function parameter typehints, and literally everywhere that wants a callback. Since there's no such thing as a function or method pointer, that definition includes a string identifying a plain function, and two array forms, [string, string] and [object, string], representing static and instance methods, respectively. You can't not accept those forms as a callback parameter in one particular function just to make things tidier. Regards, -- Rowan Collins [IMSoP]