Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88687 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74340 invoked from network); 5 Oct 2015 17:56:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2015 17:56:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:36360] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/60-05723-CB9B2165 for ; Mon, 05 Oct 2015 13:56:13 -0400 Received: by wicgb1 with SMTP id gb1so130887183wic.1 for ; Mon, 05 Oct 2015 10:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=SwBf6h9tK17q4AGD0Iaf5Zo9PA2qptCMg2fhMyjaxOI=; b=SU2jUmh8ucK6eZIUmT8nFZ2lyHULEzBqNKRBp7l/pYt+hVBTtjnUqEEAPW+KQ30dQd 7FqbWAjKEzGoRjjNo2q0OcAfO2/yLJ2qk/An8ycwYmtg17jgBWp9lfk8zjlO0WMal183 4jtmZehA5a8XtixAZYUtz6vtGdIaCIeJvfE7IPlm+Ryi/N6Rk9pbowb28szCOC9X9yrp ydsvunjEIYrwgbwV4wqzDjmuG0CIiZDvtDrAZUApCcEVaWcENablbBZS3pVZ73o4VqTC 5F/TEMPyAc7FgPyM25kn4JO4nHBWYFFpZpBGf+/5f6tEtSWcMld1Piets4eudWFNEpnc 7I7A== X-Received: by 10.194.239.104 with SMTP id vr8mr31478906wjc.72.1444067769619; Mon, 05 Oct 2015 10:56:09 -0700 (PDT) Received: from [192.168.0.126] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id hd7sm15795353wib.23.2015.10.05.10.56.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Oct 2015 10:56:08 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <5612B99D.8030308@gmail.com> Date: Mon, 5 Oct 2015 18:55:41 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] [DRAFT]: Consistent callables From: rowan.collins@gmail.com (Rowan Collins) Dan Ackroyd wrote on 29/09/2015 15:25: > Hello internals, > > Here is a draft RFC to make the callable type in PHP be consistent and > have much fewer surprises. > > https://wiki.php.net/rfc/consistent_callables To break the silence: I really like the sentiment behind this, and it seems very thorough. I've been caught out several times by the fact that this appears to work: $callback = [self, 'some_method']; Because of the legacy "feature" of treating undefined constants as strings (which IMHO should be deprecated anyway, and removed in 8.0), it becomes this: $callback = ['self', 'some_method']; ... and the 'self' is only evaluated when you come to run it, at which point it will either fatal error, or do something completely irrelevant, depending if that name happens to exist in the class context it finds itself in. The only part I have a slight concern over is the behaviour of private/protected methods, but if some form of constructor is available to neatly wrap them into closures, I think it's acceptable to require its use. The way I see it is that currently is_callable($foo) means "is $foo callable in the current context", whereas the proposal makes it "is $foo a valid value of type callable". My only other thought is that deprecation should happen in 7.1, not "7.last", because a) we should give people as much warning as possible (as soon as the replacement functionality is available to move to) rather than leaving until the last minute; and b) we won't necessarily know that a particular release is 7.last, e.g. the decision against releasing a 5.7 happened 6 months after the release of 5.6.0 Regards, -- Rowan Collins [IMSoP]