Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61972 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51811 invoked from network); 2 Aug 2012 17:12:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2012 17:12:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=g.b.yahav@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=g.b.yahav@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: g.b.yahav@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:57912] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/EB-21438-A05BA105 for ; Thu, 02 Aug 2012 13:12:43 -0400 Received: by vcbgb30 with SMTP id gb30so9559644vcb.29 for ; Thu, 02 Aug 2012 10:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9+ccvkP1U36rJM+swbtAF6b7k2XMZ+TzMy0OX/xnqYk=; b=SZbMyPt9v1A9ecb/dWTf/fOAn45MRaZbx7tXxHMn7lhByJu5BPDGwEGpYFRpf2/eOT n47WncL3SJLJ/u+fC9m4SWmkbFDCbVPFDInvnTUjCCzqFdaPs600keXc9tXhh+FaTToI SoIG3c5EyO/3wltTIwDzpM5YhOXkwQvg38yU0SQA9df9T9RWQtpu9tV/arhNU/dFup1l BJI8k8vkYbyhXyExGkBi+bOak3Z4c2Ien+JHitzp8PPrcAnH9XBlgnivunEUCPXjO91U 2A2sxdijHXMplXSUfuHIhf0I8c4LncwtgJiEsq3Nu97y5i8OPjRGYfNpOFKyMgocVcAU aYSw== Received: by 10.220.154.148 with SMTP id o20mr20666138vcw.18.1343927559599; Thu, 02 Aug 2012 10:12:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.92.18 with HTTP; Thu, 2 Aug 2012 10:12:19 -0700 (PDT) In-Reply-To: References: Date: Thu, 2 Aug 2012 20:12:19 +0300 Message-ID: To: Leigh Cc: PHP internals Content-Type: multipart/alternative; boundary=f46d0438936fcb37f004c64b84b6 Subject: Re: [PHP-DEV] Add runkit to PHP Runtime From: g.b.yahav@gmail.com (Yahav Gindi Bar) --f46d0438936fcb37f004c64b84b6 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Aug 2, 2012 at 7:56 PM, Leigh wrote: > > On Aug 2, 2012 5:44 PM, "Yahav Gindi Bar" wrote: > > > > Hi, > > > > I don't know how to tag this kind of discussion (because it's not RFC > > request). > > I've interested in runkit PECL extension and think that it should be part > > of the PHP core runtime. > > > > I do think that the implementation should be different and don't mind to > > suggest my implementation as RFC, but firstly I wish to know if you think > > that the core idea to be able to add extension methods to classes is good > > idea, so I won't start to implement a new feature without a reason (I'd > > start it but since I've saw runkit I think that we can discuss the idea > > first). > > > > I think that a code similier to this will be great: > > > > class Foo { > > public function foo() { } > > } > > > > class Bar extensionfor Foo { > > public function bar() { } > > } > > > > (new Foo())->bar(); // execute Bar method > > > > I see many pros about this feature, and you can see it in C# and ObjC > too. > > Shall I open for it a wiki page and start RFC discussion? > > What do you think? > > I think a lot of runtime features could be useful, but require tight > integration to be "done right". Maybe a candidate for 6.0 features? > > I'd personally be interested in the ability to hook built-in functions and > sandboxing. > I agree, the runkit is excellent but has to be deeply integrated to the language - for example, add methods to the Reflection extension to find out which methods added by extension methods etc. Regard the implementation - I saw and used several ways of implementing it, and do think that because one of the important pros of PHP is the language writing style which is nice and clean - we should think of good syntax. for example, C# request to add "this" keyword before each extension method, and require the class and methods to be static - for instance: public static class Bar { public static void bar(this Foo obj) { } public static int baz(this Foo obj, int bar); } new Foo().baz(1); On Thu, Aug 2, 2012 at 7:56 PM, Leigh wrote: > > On Aug 2, 2012 5:44 PM, "Yahav Gindi Bar" wrote: > > > > Hi, > > > > I don't know how to tag this kind of discussion (because it's not RFC > > request). > > I've interested in runkit PECL extension and think that it should be part > > of the PHP core runtime. > > > > I do think that the implementation should be different and don't mind to > > suggest my implementation as RFC, but firstly I wish to know if you think > > that the core idea to be able to add extension methods to classes is good > > idea, so I won't start to implement a new feature without a reason (I'd > > start it but since I've saw runkit I think that we can discuss the idea > > first). > > > > I think that a code similier to this will be great: > > > > class Foo { > > public function foo() { } > > } > > > > class Bar extensionfor Foo { > > public function bar() { } > > } > > > > (new Foo())->bar(); // execute Bar method > > > > I see many pros about this feature, and you can see it in C# and ObjC > too. > > Shall I open for it a wiki page and start RFC discussion? > > What do you think? > > I think a lot of runtime features could be useful, but require tight > integration to be "done right". Maybe a candidate for 6.0 features? > > I'd personally be interested in the ability to hook built-in functions and > sandboxing. > --f46d0438936fcb37f004c64b84b6--