Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24669 invoked from network); 27 Sep 2013 08:30:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2013 08:30:15 -0000 Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.52 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.215.52 mail-la0-f52.google.com Received: from [209.85.215.52] ([209.85.215.52:63287] helo=mail-la0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/45-28456-41245425 for ; Fri, 27 Sep 2013 04:30:13 -0400 Received: by mail-la0-f52.google.com with SMTP id ev20so1912423lab.11 for ; Fri, 27 Sep 2013 01:30:09 -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:date:message-id:subject :from:to:cc:content-type; bh=KItLkcvbHOdriR0CjGj+whCmc1YAU3/Nr0ddhwCGNJ4=; b=QQudixJacK4DHM12O+b503dFeXIoowRdjMx/LZsGrsQZ4jHfyem1BGulVo/wnHpgSl x0cxP/seXkOM8kIB+FGu18+x48XGJ2NmLhtjzByG1Ir/Ky2jwnPvmjffUQEhcVknifPX GbZBBYQ6juU10WGOY5j8Xp0+NNB6Yve8hfemrQoVzE/GMV7CJRdBA9/CUrRC/km1Y58R 7SL5IPl4sBEloaWigYiCQX3dCTJAXy95U0B0LkaZmqtuv6hud7zJh8I3i+wF8fGhgqPn ty/tNL5+tO4BGjAEC9K3j92fevuZcY6tCBR/wAgYg8sf9ByGT/bc3r1VVZkpye36j0/R 6BjA== MIME-Version: 1.0 X-Received: by 10.152.44.225 with SMTP id h1mr4647569lam.15.1380270609677; Fri, 27 Sep 2013 01:30:09 -0700 (PDT) Sender: mike.php.net@gmail.com Received: by 10.114.184.19 with HTTP; Fri, 27 Sep 2013 01:30:09 -0700 (PDT) In-Reply-To: References: <5241F11C.5080707@php.net> <008301ceb967$b49ab190$1dd014b0$@tutteli.ch> <524205D8.8000608@php.net> <5242ADAE.2080007@php.net> <5242E88D.90407@php.net> <5244095F.3090005@php.net> Date: Fri, 27 Sep 2013 10:30:09 +0200 X-Google-Sender-Auth: 9FJkfBgpF4ccWbBqhtFqmtqmaFw Message-ID: To: Nicolas Grekas Cc: Joe Watkins , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] RFC: Anonymous Classes From: mike@php.net (Michael Wallner) On 27 September 2013 09:55, Nicolas Grekas wrote: > If you need access to the methods in AProxifier then why does the anonymous >> class extend A, you should extend AProxifier as you would with any other >> class. >> > > Because A has the behavior I want to extend? > > An other example: > > class A {...} > class B {...} > > class Factory > { > protected function protectedMethod() {...} > > function getA() > { > return new class extends A {.. call Factory::protectedMethod()? ..}; > } > > function getB() > { > return new class extends B {.. call Factory::protectedMethod()? ..}; > } > } > > This is possible and welcomed with closures. > I see it as useful for anonymous classes than it is for anonymous functions. > What do others you think about it? -1 Just because a closure is an anonymous function does not mean that an anonymous class has closure capabilites. -- Regards, Mike