Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88552 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95165 invoked from network); 29 Sep 2015 15:12:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Sep 2015 15:12:25 -0000 Authentication-Results: pb1.pair.com header.from=danack@basereality.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=danack@basereality.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain basereality.com from 209.85.160.179 cause and error) X-PHP-List-Original-Sender: danack@basereality.com X-Host-Fingerprint: 209.85.160.179 mail-yk0-f179.google.com Received: from [209.85.160.179] ([209.85.160.179:33486] helo=mail-yk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/02-20099-85AAA065 for ; Tue, 29 Sep 2015 11:12:25 -0400 Received: by ykft14 with SMTP id t14so9917414ykf.0 for ; Tue, 29 Sep 2015 08:12:21 -0700 (PDT) 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=hIg2pbZ2Er4uNVz4gVNoKF3ypP1WFzR9Jy1n8NNuDkw=; b=UoiW53TXJsoxRNmaVYq/4L1wExXe0Rtf1fNLpdcUTpRbaEsEW1h6ZFqaIsAyruhZtS vUJmofFPJCUn/1he7ESV0Pa9baRYJ/FUTeM1kAuiqUoMrbnRucrI1op5AxtbQBa4mDeW gqWvoStfxU/o+W+3C1DykjTKFjljW/D6Dbu3G2w3Q0LJZJ36Cad5C4fznrYpdMZSVXQD 4gSVAxi1djjuvWHMbPl+ahbGzWDRjknHXWbu0FpWdWqHUPblHrevUfSmu5N/keeB4cFr SOJtoSz01d5O2zeXkYYt6FO+E2YYDyAS6I3nTETzh5UzzkXZdT3Gy60WdGvqpqeyK5xg A6yw== X-Gm-Message-State: ALoCoQn8KHaLOKOBkDs0W2hGP/Pxf/jk8zfSUIdwddZKD+XrpcUqbpkI4N1i6yfVY2k2/RinOi6a MIME-Version: 1.0 X-Received: by 10.13.220.6 with SMTP id f6mr22065859ywe.34.1443539541337; Tue, 29 Sep 2015 08:12:21 -0700 (PDT) Received: by 10.37.76.137 with HTTP; Tue, 29 Sep 2015 08:12:21 -0700 (PDT) X-Originating-IP: [2.99.234.206] In-Reply-To: References: Date: Tue, 29 Sep 2015 15:12:21 +0000 Message-ID: To: Peter Petermann Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable From: danack@basereality.com (Dan Ackroyd) On 29 September 2015 at 14:56, Peter Petermann wrote: > why not just do "return function() { $this->myPrivateMethod(); };" That would not work if there were any parameters to the function. Also all other information would need to be duplicated e.g. the return type. > this should be easy enough to do userland, including checking if the method exists It depends what you consider 'easy'. Here is an implementation https://gist.github.com/Danack/27254e80b56bf477fd1f As I said in the RFC, it does a significant chunk of work in userland, including an exciting use of debug_backtrace to get the calling scope. I am not sure it is actually a complete implemenation. I got tired of writing it, and decided that it would be better implemented in PHP core. cheers Dan