Re: RFC: Anonymous Classes

From: Date: Mon, 23 Sep 2013 09:09:32 +0000
Subject: Re: RFC: Anonymous Classes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-69266@lists.php.net to get a copy of this message
2013/9/23 Derick Rethans <derick@php.net> > On Mon, 23 Sep 2013, Joe Watkins wrote: > > > https://wiki.php.net/rfc/anonymous_classes > > This RFC misses one very important part: an argument for why this > feature is useful. Syntax changes are likely to be extremely contentious > and without convincingreasoning *why* we need this, we shouldn't even > consider looking at an RFC. > > I use anonymous classes very frequently in Java and in C#, and I would say that they are quite useful. However the examples given in the RFC are really bad ones. Why on earth would you need a constructor for an anonymous class? Anonymous classes are used to implement quickly some interface. Frankly, constructors are not part of any interface. Besides a constructor is totally useless in an anonymous class as it will never be called after the object is created. Let's not rule out this feature yet. It's just a weak RFC, so let's wait for better approaches. Lazare INEPOLOGLOU Ingénieur Logiciel

« previous php.internals (#69266) next »