[PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Kenan R Sulayman
Hi, I'd like to propose a new function: spl_class_vars / params / contents. Notice: I haven't figured out a name yet Please help me find one.. :-) The function returns an array of the contents of the given class-object. The class-object parameter may be text or rather directly the object ( new f

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 8:30 PM, Kenan R Sulayman wrote: > Hi, > I'd like to propose a new function: spl_class_vars / params / contents. > > Notice: I haven't figured out a name yet Please help me find one.. :-) > > The function returns an array of the contents of the given class-object.

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Sebastian Bergmann
Etienne Kneuss schrieb: > Why can't you use Reflection in this case? It looks like you can quite > easily implement that in userland from Reflection. Especially using setAcessible() which was added in PHP 5.3. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Ke

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Guilherme Blanco
setAcessible() is the way to go! Doctrine 2.0 took advantage of it to be able to move to a completely VO mapping of models. =) Cheers, On Wed, Jan 21, 2009 at 5:43 AM, Sebastian Bergmann wrote: > Etienne Kneuss schrieb: >> Why can't you use Reflection in this case? It looks like you can quite >

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
Thanks, I did propose the function because the construction in user-land is quite expensive; Actually tests showed: the user-land algorithm of mapping these objects (regarding a count of thousand; up to a half million objects / iterations) took 0,2 - 70 seconds to execute! Therefore: I would be v

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Karsten Dambekalns
Hi. On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it for FLOW3 is to create a ReflectionService that caches such information as long as the source doesn'

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Lukas Kahwe Smith
On 21.01.2009, at 12:00, Karsten Dambekalns wrote: Hi. On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it for FLOW3 is to create a ReflectionService t

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Christian Schneider
Lukas Kahwe Smith wrote: > On 21.01.2009, at 12:00, Karsten Dambekalns wrote: > >> On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: >>> I did propose the function because the construction in user-land is >>> quite >>> expensive; >> >> Reflection is expensive, indeed. The way we solved it for FLOW3

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Sebastian Bergmann
Christian Schneider schrieb: > Yes, please. Keep clutter out of the engine especially for stuff which > should not be used often. If you are relying on Reflection to be fast > for you everyday code then you're IMHO doing something weird and it is > ok that you have to write your own caching for it

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nathan Rixham
Christian Schneider wrote: Lukas Kahwe Smith wrote: On 21.01.2009, at 12:00, Karsten Dambekalns wrote: On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it f

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
First: I'd understand, I've to build the caching system on my own; Second: I'd vote for speeding up Reflection. Thanks, -- (c) Kenan Sulayman Freelance Designer and Programmer Life's Live Poetry 2009/1/21 Nathan Rixham > Christian Schneider wrote: > >> Lukas Kahwe Smith wrote: >> >>> On 21.01.

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Christian Schneider
Nathan Rixham wrote: > seems to me that many of the new requests coming in, including my own > stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflection (or even other fancy features not yet in PHP) for this.

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nathan Rixham
Christian Schneider wrote: Nathan Rixham wrote: seems to me that many of the new requests coming in, including my own stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflection (or even other fancy features

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Roman Borschel
On Jan 21, 2009, at 4:20 PM, Christian Schneider wrote: Nathan Rixham wrote: seems to me that many of the new requests coming in, including my own stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflecti

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nate Gordon
My personal favorite use of Reflection is Class Factories. While this could be done with: It seems a little blunt to me, it also doesn't support having a variable number of arguments to the constructor. I've seen some pretty egregious hacks to make the above code work with a variable number of

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Sebastian Bergmann
Roman Borschel schrieb: > Would you mind sharing (off-list) how you get data in and out of the > objects **transparently** Have a look at lp:php-object-freezer. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 686