Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84448 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64327 invoked from network); 9 Mar 2015 00:26:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2015 00:26:00 -0000 Authentication-Results: pb1.pair.com header.from=pjsturgeon@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pjsturgeon@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.178 as permitted sender) X-PHP-List-Original-Sender: pjsturgeon@gmail.com X-Host-Fingerprint: 209.85.217.178 mail-lb0-f178.google.com Received: from [209.85.217.178] ([209.85.217.178:45941] helo=mail-lb0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/72-44738-798ECF45 for ; Sun, 08 Mar 2015 19:26:00 -0500 Received: by lbiz12 with SMTP id z12so39902134lbi.12 for ; Sun, 08 Mar 2015 17:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=27jBo907IiF3q/vCEZul3PocNkXhojJ4g+DwptUbf/g=; b=DsOKLb7xe8BozBgmTqaqdhxbOqBTDnmt4dQaqlmB9qDYKmFZBWvsJT+cYegPUHMfsM W+rOo+dP2/7p8z9pQvg+zrAUA8b6jVad2WPTCjkNDwXUkrPWtRjmPtpkBeDdBVCEhf1x pW4cswL/fL4X3bGM8AKaKegD6Sbw9FbHQgtUoFx3S07v/EYsR2JaGB9P/kDdjCsLNWRp Z3ZyuT/nkJ55lAKgXyCeb8V8Z073vwLdBpB1CTMxiX4wgF0EImelCAmkq1Og6aUF1jV5 IqQPd2Vj9Fl1EU4ZerxMZ/F/9eIPzjmd0F0LxRMygtBspV5LrTfe/KIt9eWi3OezjKyd bzEw== MIME-Version: 1.0 X-Received: by 10.153.8.135 with SMTP id dk7mr22768336lad.93.1425860756252; Sun, 08 Mar 2015 17:25:56 -0700 (PDT) Received: by 10.114.26.34 with HTTP; Sun, 8 Mar 2015 17:25:56 -0700 (PDT) In-Reply-To: <54FA3B69.1050709@gmail.com> References: <010801d055d3$ed5a8fa0$c80faee0$@tutteli.ch> <004d01d05696$9d797410$d86c5c30$@tutteli.ch> <54FA3B69.1050709@gmail.com> Date: Sun, 8 Mar 2015 20:25:56 -0400 Message-ID: To: Stanislav Malyshev Cc: Robert Stoll , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Anonymous Classes From: pjsturgeon@gmail.com (Philip Sturgeon) Stanislav, On Fri, Mar 6, 2015 at 6:42 PM, Stanislav Malyshev wrote: > Hi! > Couple of points to clarify: > > 1. Is the new syntax "new class ..." or just "class ..." and new works > the same? I.e. could you do: > > $foo = class extends Callback { ... } > $bar = new $foo; Nope, none of that. Wrap that in a function or clone it perhaps. > 2. What is the scope of the anonymous class? Can it get access to > parent's variable scope? Private functions? Works the same as any named class. No new special rules here. Play around on 3v4l and show me an example of something you don't like, or make sure it works the way you expect.