On Thu, Aug 2, 2012 at 7:56 PM, Leigh <lei...@gmail.com> wrote:

>
> On Aug 2, 2012 5:44 PM, "Yahav Gindi Bar" <g.b.ya...@gmail.com> 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 <lei...@gmail.com> wrote:

>
> On Aug 2, 2012 5:44 PM, "Yahav Gindi Bar" <g.b.ya...@gmail.com> 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.
>

Reply via email to