Re: [PHP-DEV] RFC: about class names as values

2011-01-13 Thread Chad Fulton
Take this with a grain of salt, but: On Thu, Jan 13, 2011 at 7:22 AM, Martin Scotta wrote: > Hi all, > > I don't know how the internal development process of PHP works. > > First at all: was this feature approved? >From my experience, don't consider something "approved" until it's in SVN, and ev

Re: [PHP-DEV] RFC: about class names as values

2011-01-13 Thread Martin Scotta
Hi all, I don't know how the internal development process of PHP works. First at all: was this feature approved? if that is a "yes"... is this feature going to be scheduled for some release? Is it supposed that I will submit a patch? Thanks you all, Martin Scotta On Sun, Jan 9, 2011 at 11:07

Re: [PHP-DEV] RFC: about class names as values

2011-01-09 Thread Martin Vium
I think adding a magic constant or method for getting the class name would be usefull in many scenarios, when referencing a specific class (e.g. factories, configurations). It would also work well with namespaces and refactoring tools e.g.: $mock = $this->getMock('\\My\\Custom\\Namespace\\MyClass'

Re: [PHP-DEV] RFC: about class names as values

2011-01-08 Thread Ben Schmidt
I think doing something like this is a good idea for classes and interfaces. Ben. On 7/01/11 1:16 AM, Martin Scotta wrote: Yes, my intention was to only add a magic constant with the class, similar to this namespace Bar { class Foo { const KLASS = __CLASS__; } } namespace Buzz {

Re: [PHP-DEV] RFC: about class names as values

2011-01-07 Thread Martin Scotta
Hi all, I've wrote a simple snippet to show the importance of this feature. This little piece of code, at a glance, tries to instantiate 2 same objects by different ways, but fails because of a silently code bug. -- start of code test(); $class = 'B\C\Foo'; $f2 = new $class; $f2->tes

Re: [PHP-DEV] RFC: about class names as values

2011-01-07 Thread Adi Nita
Hi, To proper support this we'd have to make classes first class elements. > For making this consistent it would make sense to make functions first > class elements. And best drop the $ in front of variables and create a > new language. Everything else becomes a mess. > Closures are first-class c

Re: [PHP-DEV] RFC: about class names as values

2011-01-06 Thread Martin Scotta
Yes, my intention was to only add a magic constant with the class, similar to this namespace Bar { class Foo { const KLASS = __CLASS__; } } namespace Buzz { use \Bar\Foo as BazFoo; class Bar extends BazFoo { const KLASS = __CLASS__; } $bar = new Bar; $baz = new BazFoo;

Re: [PHP-DEV] RFC: about class names as values

2011-01-05 Thread John LeSueur
2011/1/5 Johannes Schlüter > On Wed, 2011-01-05 at 21:53 -0300, Martin Scotta wrote: > > $obj = newInstance( MyClass ); // notice. undefined constant MyClass > > This describes the major change with your idea. > > What happens if a constant MyClass exists? > > Another question is something like t

Re: [PHP-DEV] RFC: about class names as values

2011-01-05 Thread Johannes Schlüter
On Wed, 2011-01-05 at 21:53 -0300, Martin Scotta wrote: > $obj = newInstance( MyClass ); // notice. undefined constant MyClass This describes the major change with your idea. What happens if a constant MyClass exists? Another question is something like this: To proper support this we'd have