Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83664 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86932 invoked from network); 24 Feb 2015 14:10:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2015 14:10:49 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:35534] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/71-10521-4668CE45 for ; Tue, 24 Feb 2015 09:10:46 -0500 Received: by mail-vc0-f173.google.com with SMTP id hy4so10027537vcb.4 for ; Tue, 24 Feb 2015 06:10:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=AWK/iPSeYhhAQW7SJD3DIpjUlpgrJWdGhBeVpkr78XQ=; b=KYud0L9ufpaSw2luYCRu4r0SqQt25i/J5TgrtWnDI+ohHGXf7vjFLAg6D8Tf1gchP3 4R+L0klAe15U6yvazKUKnVaNJVoKGVOcjBQ620buVV3rpG+QJl9gA/o4iSONhHXL9hAr I2+D52PC5v6AV6+dkpU4TaHqOqaa372H3OyH3QLUmZmPchGukPT/M8NbaztivYE3M+QL QqVJypitbEZABm6EfJCGf+ujUfOEEyuSoC997hBbUPLYaqftHj3f/R4FyW1hKNC59I7R YRpVjZd0X+2IqxBbtRtfCnJnBRNtwiQY6htr5GaJKGjt9q50Lmb8jS7fecuVK9ySwsu1 TnQw== X-Gm-Message-State: ALoCoQkBn0CVAztPDZLcMFQGAI0phmiuHLnpzT44emjIhLQAb31MZPHN88So+rWt924G5DeIJ/X+0br88HzuZeWCPheOBFVUHuOuu25o33dq8MqLC4rm9/pkFK5XqxLZMJ2kUSgqYpLcJ1k79ieBQO1NywKfBfgvVA== MIME-Version: 1.0 X-Received: by 10.52.25.11 with SMTP id y11mr15485088vdf.51.1424787042181; Tue, 24 Feb 2015 06:10:42 -0800 (PST) Received: by 10.52.113.231 with HTTP; Tue, 24 Feb 2015 06:10:42 -0800 (PST) In-Reply-To: References: Date: Tue, 24 Feb 2015 18:10:42 +0400 Message-ID: To: Philip Sturgeon Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a1133e5f287c697050fd6155e Subject: Re: [PHP-DEV] [RFC] Anonymous Classes From: dmitry@zend.com (Dmitry Stogov) --001a1133e5f287c697050fd6155e Content-Type: text/plain; charset=UTF-8 I think the proposal is a bit incomplete. It's possible to instantiate an anonymous class, but currently it's not possible to do with them anything else (assign to variable, pass to function, etc). Something similar to Closure objects should be introduced. Thanks. Dmitry. On Tue, Feb 24, 2015 at 4:52 PM, Philip Sturgeon wrote: > Good day! > > https://wiki.php.net/rfc/anonymous_classes > > There's a little RFC + patch that Joe Watkins put together, and as > before with the ArrayOf RFC, I'll be helping out. > > So, lets get this discussion rolling. > > It was declined for PHP 5 some time ago, and has returned now to try for > PHP 7. > > The usage of anonymous classes to some will be instantly offensive, > but really it comes down to the use case. The usage of anonymous > functions compared to declared functions is pretty much the exact same > thing as anonymous classes. > > Other than examples on the RFC, Fractal would certainly be happy to > have them: http://fractal.thephpleague.com/transformers/ > > Defining a class properly is certainly still going to be the majority > of uses of classes in PHP. That helps with the Optimizer, and helps > code reuse. > > Sadly due to the way in which people have had ONE CLASS ONE FILE > drilled into their head since PEAR and continuing through Zend and > PSR-0, it can become a PITA to add some simple functionality if a > small class is needed for one tiny thing. > > Anonymous functions alleviate that annoyance with a simple and > consistent feature that just give people a nice simple option to get > their jobs done, without hitting autoloaders and file systems to do > it. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1133e5f287c697050fd6155e--