Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69344 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3790 invoked from network); 26 Sep 2013 09:29:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2013 09:29:16 -0000 Authentication-Results: pb1.pair.com header.from=nicolas.grekas@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.44 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 209.85.212.44 mail-vb0-f44.google.com Received: from [209.85.212.44] ([209.85.212.44:35369] helo=mail-vb0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/7A-46303-C6EF3425 for ; Thu, 26 Sep 2013 05:29:16 -0400 Received: by mail-vb0-f44.google.com with SMTP id e13so628594vbg.31 for ; Thu, 26 Sep 2013 02:29:13 -0700 (PDT) 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=W8BzlpsRuBv7NJ8Jzreo0KsPqYiHGlTKWaenHo6m4k8=; b=yR7rMLO2TSApXE8fTxQ+37+hxrevC49wwnVTLQIEKmsJd9H7o0Y6mAOLYhG75l7gEW SRFG5ri6b6loj8lJ6gk2TnYLcahCLiYUZDu/Bk61Jur+lR2O2nG0DosYGEDJbEvBoEK7 GcUZjEBSQH1jHBg6IAz5iC56aozPNKupK5jStr2uG+EwGxLc+moGibDx2G5P9ULgzMlF +5m0WYWYKaN8Cudk/iY86BBqsUH5JUZuKBl+utlxNIahB7M4uPfu2dCj+dGZh4F9D5mQ 1Jy75/Znfd4KqlvKwpVncjivm6K1XAajTYP+M93yzrloqHQ86n+mliPOYrc2Uuycc/5s aE0w== X-Received: by 10.58.212.8 with SMTP id ng8mr19814vec.55.1380187753287; Thu, 26 Sep 2013 02:29:13 -0700 (PDT) MIME-Version: 1.0 Sender: nicolas.grekas@gmail.com Received: by 10.52.249.80 with HTTP; Thu, 26 Sep 2013 02:28:53 -0700 (PDT) In-Reply-To: <5242E88D.90407@php.net> References: <5241F11C.5080707@php.net> <008301ceb967$b49ab190$1dd014b0$@tutteli.ch> <524205D8.8000608@php.net> <5242ADAE.2080007@php.net> <5242E88D.90407@php.net> Date: Thu, 26 Sep 2013 11:28:53 +0200 X-Google-Sender-Auth: mzcepVX1fckgAdjBqrDCFP2e8r0 Message-ID: To: Joe Watkins Cc: "internals@lists.php.net" , Terence Copestake Content-Type: multipart/alternative; boundary=047d7bd6af50c2170c04e7460023 Subject: Re: [PHP-DEV] RFC: Anonymous Classes From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --047d7bd6af50c2170c04e7460023 Content-Type: text/plain; charset=ISO-8859-1 I think what Terence was talking about is more like this: class A { } class AProxifier { protected function protectedMethod() {...} function getAProxy() { return new class extends A { /* How do you call AProxifier->protectedMethod() here? */ }; } } This is possible with anonymous functions, that's a big feature of PHP5.4. And for the same reasons might be expected here too? I don't have the answer, just raising the point. (new class ... >> protected $value; >> public function __construct($value) >> { >> $this->value = $value; >> } >> >> public function doSomething() >> { >> echo $this->value; >> })($val) >> > Btw, I can't get used to ($val) beeing at the end of the declaration. I feel it very confusing. Nicolas --047d7bd6af50c2170c04e7460023--