Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58895 invoked from network); 8 Dec 2012 23:12:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2012 23:12:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=adamjonr@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adamjonr@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.49 as permitted sender) X-PHP-List-Original-Sender: adamjonr@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qa0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:59039] helo=mail-qa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/A6-13109-A59C3C05 for ; Sat, 08 Dec 2012 18:12:27 -0500 Received: by mail-qa0-f49.google.com with SMTP id r4so660722qaq.8 for ; Sat, 08 Dec 2012 15:12:23 -0800 (PST) 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=jqasWGUAL+UvgA3Dy0juU3QxiMwAT6hHtBL8XyrWxdo=; b=GLK0Dgl5/aUhOU5YWZRKK7a8huHbH7IFvupzHmvj3zsphbTyk8WjHLN3bxdBgyK1lt Bcl2j+BHywcjnVcA0bXRZZAON8oljLFOkbn+VDwLxbPeMtGNJwdy4vQ215TpiANmjctx zaM8uixRYxDzWxbg+JwCHKtwJJo2fJxm0uO0NLppW7IgejMqfslWihymrWqS70xow+8y ZePVQjbwUb7jCqkfOOenXMiWcmBUJFWd6fbFa4YGvmoQbKY3p0oswcU78a+LkF6wk+aO 23wHio2k/+Sle803IIc9T82D4EYLVR1p+xR8MCMozE6DLPJRiJhUvttyo42DUm5tccHh A3VA== MIME-Version: 1.0 Received: by 10.224.59.209 with SMTP id m17mr18050373qah.49.1355008343795; Sat, 08 Dec 2012 15:12:23 -0800 (PST) Received: by 10.229.206.202 with HTTP; Sat, 8 Dec 2012 15:12:23 -0800 (PST) In-Reply-To: <50C3C0D4.1040600@mrclay.org> References: <50C3C0D4.1040600@mrclay.org> Date: Sat, 8 Dec 2012 18:12:23 -0500 Message-ID: To: Steve Clay Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf306f76b6ffe63a04d05f76f6 Subject: Re: [PHP-DEV] Call closure stored as object property directly without use of temporary variable From: adamjonr@gmail.com (Adam Jon Richardson) --20cf306f76b6ffe63a04d05f76f6 Content-Type: text/plain; charset=ISO-8859-1 On Sat, Dec 8, 2012 at 5:36 PM, Steve Clay wrote: > On 12/8/12 4:48 PM, Adam Jon Richardson wrote: > >> call closures that are stored as object properties directly without having >> to make use of a temporary variable. >> > ... > > $o = new stdClass(); >> $o->func = function(){ >> return 'Yes!'; >> }; >> $o->func(); >> > > The following expression avoids PHP's dilemma of distinguishing > prop/method, but fails because you can't execute an expression: > > ($o->func)(); > I actually tried that very technique before remembering the limitation :) Interesting idea. Adam --20cf306f76b6ffe63a04d05f76f6--