Re: [PHP-DEV] __toString(), __toArray()

2010-01-13 Thread Etienne Kneuss
Hello, On Tue, Jan 12, 2010 at 11:40 PM, Chris Stockton chrisstockto...@gmail.com wrote: Hello, On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote: cast is not needed in PHP i 'd rather be more interesting in class Obj {     function __catch($data, $type) {            

Re: [PHP-DEV] __toString(), __toArray()

2010-01-13 Thread Ionut G. Stan
It appears that, mm w is talking about some aspect oriented feature. I would welcome a magic method that would intercept calls/access to existing methods/properties (not only inaccessible ones), in the same sense that __getattribute__ works in Python for example IIRC. It may also be a good

Re: [PHP-DEV] __toString(), __toArray()

2010-01-13 Thread Clint Priest
Etienne Kneuss wrote: Hello, On Tue, Jan 12, 2010 at 11:40 PM, Chris Stockton chrisstockto...@gmail.com wrote: Hello, On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote: cast is not needed in PHP i 'd rather be more interesting in class Obj { function __catch($data,

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread Chris Stockton
Hello, On Mon, Jan 11, 2010 at 8:32 PM, mm w 0xcafef...@gmail.com wrote: cast is not needed in PHP i 'd rather be more interesting in class Obj {     function __catch($data, $type) {            //$type [ static_method, method, get_property, set_property]            if (observed  $type ==

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
don't worry it's only for people who are working with MVC and RootObject structure, there is too much magics already and __cast is not needed at all, as we cannot monkey patch to add an observer on itself, a nice solution should have a catchable object so __catch any calls function __catch($data,

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread Eddie Drapkin
How does this have *anything* to do with the discussion at hand? On Tue, Jan 12, 2010 at 9:09 PM, mm w 0xcafef...@gmail.com wrote: don't worry it's only for people who are working with MVC and RootObject structure, there is too much magics already and __cast is not needed at all, as we cannot

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
the multiplication of magic, the pointed point, need to read more carefully On Tue, Jan 12, 2010 at 6:10 PM, Eddie Drapkin oorza...@gmail.com wrote: How does this have *anything* to do with the discussion at hand? On Tue, Jan 12, 2010 at 9:09 PM, mm w 0xcafef...@gmail.com wrote: don't worry

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread Eddie Drapkin
What you're proposing is just forcing __call, _callStatic, __get and __set into a single method, which does nothing to reduce the amount of magic, only obfuscate it. And it certainly offers no alternative to __cast, at least not that I can see. On Tue, Jan 12, 2010 at 9:11 PM, mm w

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
I am not forcing anything, it's already there, that's definitely a more useful magic, if people would add a new one, __cast is not critical, catchable objects are __catch even if exists, so my point I 'd rather see useful requests than a unseful one e.g __cast from my perspective __toString and

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread Clint Priest
Eddie Drapkin wrote: What you're proposing is just forcing __call, _callStatic, __get and __set into a single method, which does nothing to reduce the amount of magic, only obfuscate it. And it certainly offers no alternative to __cast, at least not that I can see. I agree, moving all magic

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
I don't move any magics,I am worried about your knowledge of php, there's people to give you money ? weird, set get call are only call when something doesn't exist catch or catch-able concept is to be able to catch any existing calls no the dynamic ones. On Tue, Jan 12, 2010 at 6:59 PM, Clint

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread Chris Stockton
I don't move any magics, I'm worried your knowledge of social skills? Theirs people be your friends? Weird On Jan 12, 2010 9:10 PM, mm w 0xcafef...@gmail.com wrote: I don't move any magics,I am worried about your knowledge of php, there's people to give you money ? weird, set get call are only

Re: [PHP-DEV] __toString(), __toArray()

2010-01-12 Thread mm w
:-D, without any magic, I am sorry if I hurt you I though you were tougher than a cookie, don't worry about my friends I have plenty on face-cooked, but for God Sake I am still eating alone at noon 8-) On Tue, Jan 12, 2010 at 9:50 PM, Chris Stockton chrisstockto...@gmail.com wrote: I don't

Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Etienne Kneuss
Hello, On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net wrote: I know there's been requests to add a __toArray() and most of the arguments against it is that there are too many magic functions already.  I just thought I'd propose an alternative that would satisfy all of them.

Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Stanislav Malyshev
Hi! Why not a __cast($Type) magic function? The interesting thing is that in the engine the object handler is actually: typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type TSRMLS_DC); i.e. the handler is already generic, but implementation API isn't - standard engine

Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Clint Priest
Etienne Kneuss wrote: Hello, On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net wrote: I know there's been requests to add a __toArray() and most of the arguments against it is that there are too many magic functions already. I just thought I'd propose an alternative that

Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread mm w
cast is not needed in PHP i 'd rather be more interesting in class Obj { function __catch($data, $type) { //$type [ static_method, method, get_property, set_property] if (observed $type == set_property somevalueIsObserved) {