Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82745 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88775 invoked from network); 15 Feb 2015 19:48:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2015 19:48:28 -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 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wg0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:47293] helo=mail-wg0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/50-21457-B08F0E45 for ; Sun, 15 Feb 2015 14:48:27 -0500 Received: by mail-wg0-f47.google.com with SMTP id x12so12207496wgg.6 for ; Sun, 15 Feb 2015 11:48:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=vObyt7qlU6unnrZLBm90Fsxk33aaC8HFRvTRIqj11bU=; b=nHGWTfmGpMIlMo0Xo6woSndNEfB0B1y69DD7rG6Jt4Mmy3b+Gg0SeRBQHepnSDRiUx PdX06j34A8HpmFbsR37Vc9svuyL8OOg0azBoxEU2VTFyZHMfGDkbRx+qA/6dE1hyBDU+ SuplDZLoV0J7otqAtZ5G+qXaLOmtGd2w9UmDfFh3QLl1BgIThgsiQznK29fBzLJBkkfd VQP4v81f4BkHDu5WdEUgfdL4VCae4/OccsAKw93mF2MfR2Bgdpd9xag7MalNeg9Prsl6 Exm+sHsMx61MkAqfnH7FgDAooF3+c/ttyGg7Q2JzaDozNQQVSjQRPSrJekSbXNJCwCf1 X8dA== X-Received: by 10.180.104.3 with SMTP id ga3mr16817976wib.66.1424029703982; Sun, 15 Feb 2015 11:48:23 -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 n10sm16389228wic.11.2015.02.15.11.48.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Feb 2015 11:48:23 -0800 (PST) Message-ID: <54E0F7F9.2060406@gmail.com> Date: Sun, 15 Feb 2015 19:48:09 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54DD1BB1.1090501@gmail.com> <54DD815F.70504@mabe.berlin> <54DD8AA9.3040808@gmail.com> <752856272.5008.1423809953291.JavaMail.open-xchange@app07.ox.hosteurope.de> <54DDAC30.7090206@gmail.com> <54DFAA20.4000900@mabe.berlin> <0C346B4A-94E7-4865-9698-044F21FDBC5F@gmail.com> <54E0F45A.6060208@mabe.berlin> In-Reply-To: <54E0F45A.6060208@mabe.berlin> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Remove $this from incompatible context From: rowan.collins@gmail.com (Rowan Collins) On 15/02/2015 19:32, Marc Bennewitz wrote: > > Am 15.02.2015 um 19:09 schrieb Rowan Collins: >> >> >> The static modifier for methods is part of the method signature and >> method body isn't. >> (That's way interfaces doesn't describe method bodies but signatures) >> >> The static modifier defines a method as static and therefore defines >> the >> method is callable using "::". >> More specifically, it defines that the method is *only* callable >> statically. There is currently no opposite keyword to say that a >> method can only be called non-statically, but the absence of a >> modifier has up until now meant that either call type is possible. An >> interface cannot currently forbid static calls, only the use of $this. >> >> Our choice is between keeping that ambiguity, and introducing a new >> rule that any method not marked static must never be called >> statically (with provisos for technically non-static parent:: etc). >> >> Regards, > > The problem with the current behavior of "... the absence of a > modifier has up until now meant that either call type is possible" is > that the library author can't define a method as non static callable > and the caller defines if $this can be used. Agreed. Personally, I'm a great fan of symettry, so part of me would prefer to introduce a keyword for when you *can't* call a method statically, e.g. "instance function foo() { ... }". But I guess instance methods are, or at least "should" be, the majority, so it makes sense to reserve the un-annotated form for them. I worry about how many people will still miss the deprecation warning, but then I'm a broken record on the subject of PHP's warning system needing an overhaul. Regards, -- Rowan Collins [IMSoP]