Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74147 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61576 invoked from network); 13 May 2014 16:25:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 May 2014 16:25:01 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.171 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.171 mail-ob0-f171.google.com Received: from [209.85.214.171] ([209.85.214.171:53709] helo=mail-ob0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/71-53767-C5742735 for ; Tue, 13 May 2014 12:25:01 -0400 Received: by mail-ob0-f171.google.com with SMTP id wn1so671155obc.2 for ; Tue, 13 May 2014 09:24:58 -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=eQugs0UswV4OwIdhBkFG/3pAaRHIlm1jrJKHIUoo9zw=; b=Oqf4IJHrLMZj/JrDIG0PMIMjObI1zQ8wQbD7bPeVkxCFq6qu6Wohi83Wq9CgS9iIg1 OXh6FREvAewWHUR1qkYIiukOGCL952icaFtWMdMqeK47ratPeUPfDZ7yF+de3HzDtVnC H/SmhPbncjFR6deOtP3k8InNIXRojdpVDq6vVqeKmmGwqLYgfjyEqXjAvkJIyHu3MRsF iecDP3ZI/ikgSWTGGteBsyngIuirwhHAXUMW/XG4JTUEuix77mPyuEpvL7OXA5nsYOWw 6Nto5HrZmjTy6NfvxIKbRTy1IYrvDm4obpXfj206fUoHRVgSNpTVFcXpys2Fl0vKqGDK kfyg== MIME-Version: 1.0 X-Received: by 10.182.43.132 with SMTP id w4mr43376875obl.41.1399998298247; Tue, 13 May 2014 09:24:58 -0700 (PDT) Received: by 10.76.77.100 with HTTP; Tue, 13 May 2014 09:24:58 -0700 (PDT) In-Reply-To: References: <536D3C30.9010801@sugarcrm.com> Date: Tue, 13 May 2014 10:24:58 -0600 Message-ID: To: Stas Malyshev Cc: internals Content-Type: multipart/alternative; boundary=001a11c303a240d79e04f94a811a Subject: Re: [PHP-DEV] Anonymous functions inside static methods. From: morrison.levi@gmail.com (Levi Morrison) --001a11c303a240d79e04f94a811a Content-Type: text/plain; charset=UTF-8 > > Another option is to implicitly promote closures inside of static contexts > > to be also be static; this is basically what HHVM does. > PHP does this! That's why you get 'Cannot bind an instance to a static > closure' if you closure->bindTo() inside a static method, even if > the closure itself is not keyworded `static`. I didn't explain that well enough; I meant that it automatically promotes the closure to be 'static' in that it uses late static binding. > The difference between HHVM and PHP is the default class scope of the > closure. PHP makes the decision that the owning class scope of the > closure is the compile-time class of the parent method. Why this was > done I couldn't say. This is actually the same issue as the one above. Basically the closures aren't respecting late static binding and I am pretty sure it was just an oversight, not a conscious decision. --001a11c303a240d79e04f94a811a--