Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Marcus Börger
Hello Cristiano, Wednesday, August 6, 2003, 3:19:34 PM, you wrote: CD> Simeon Koptelov wrote: >> Hello Cristiano, >> >> Here's why i think that interface is not good solution. >> >> We need the toString method like java's one to >> safely assume that _every_ object has the string representation

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Alan Knowles
switch/case removed and patch attached. Is it ok? Should the method be named "to_string()", "tostring()" or "__tostring()" ? According to the current Coding Standard document.. it should be toString() : even though php is not Case-sensitive:).. Would be nice to see this work.. Regards Alan Do y

Re: Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Cristiano Duarte
Hello Marcus, Did you think of a better interface name instead of "Printable" ? Do you think Zeev or Andi will accept this patch ? Cristiano. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Cristiano Duarte
"Alan Knowles" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > > >What about __construct, __destruct and __clone ? AK> these are built in. - and done to avoid conflicts. All right. > >Shouldn't it be named > >__to_string() or __tostring() ? > > AK> since you implicitly make this

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Cristiano Duarte
Simeon Koptelov wrote: Hello Cristiano, Here's why i think that interface is not good solution. We need the toString method like java's one to safely assume that _every_ object has the string representation. This means we can say $obj1->toString() and $obj2->toString() and don't care if $obj1 and

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-14 Thread Cristiano Duarte
Hi all, SK> Maybe it will be better to have this method in all classes and define SK> default behavior such as existing ( string )$object cast? I guess that using an interface is better. But if the guys here think different I would revert to the patch with no interfaces. AK> According to the curr

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-11 Thread Alan Knowles
AK> According to the current Coding Standard document.. it should be AK> toString() : even though php is not Case-sensitive:).. What about __construct, __destruct and __clone ? these are built in. - and done to avoid conflicts. Shouldn't it be named __to_string() or __tostring() ? since you imp

Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-10 Thread Marcus Börger
Hello Cristiano, Saturday, August 9, 2003, 10:48:22 PM, you wrote: CD> Hello Marcus, CD> Did you think of a better interface name instead of "Printable" ? CD> Do you think Zeev or Andi will accept this patch ? I guess they won't like it and i would agree. I'd like to see something that hooks in

Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-08 Thread Simeon Koptelov
Hello Cristiano, Here's why i think that interface is not good solution. We need the toString method like java's one to safely assume that _every_ object has the string representation. This means we can say $obj1->toString() and $obj2->toString() and don't care if $obj1 and $obj2 do support this

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-05 Thread Cristiano Duarte
Hi Marcus, "Marcus BöRger" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > CD> I don't know how to throw an error/exception from inside the core of Zend2. > CD> I have some code to throw an exception/error from extensions... > > Simply set EG(exception) = class... > and experime

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-04 Thread Marcus Börger
Hello Cristiano, Monday, August 4, 2003, 4:45:20 AM, you wrote: CD> Hello Marcus, >> CD> switch/case removed and patch attached. Is it ok? >> CD> Should the method be named "to_string()", "tostring()" or "__tostring()" ? >> CD> Do you commit it to CVS ? >> >> No. Last Problem i see is that even

Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-04 Thread Marcus Börger
Hello Simeon, Monday, August 4, 2003, 2:33:00 PM, you wrote: SK> Hello Cristiano, SK> Monday, August 4, 2003, 8:45:20 AM, you wrote: >>> CD> Should the method be named "to_string()", "tostring()" or CD>> "__tostring()" ? SK> Maybe the __tostring() will be the best because few naming SK> conven

RE:Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-04 Thread Simeon Koptelov
Hello Cristiano, Monday, August 4, 2003, 8:45:20 AM, you wrote: >> CD> Should the method be named "to_string()", "tostring()" or CD> "__tostring()" ? Maybe the __tostring() will be the best because few naming conventions for methods exist. Some people prefer C-like some_method(), some like Java-

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Cristiano Duarte
Hello Marcus, > CD> switch/case removed and patch attached. Is it ok? > CD> Should the method be named "to_string()", "tostring()" or "__tostring()" ? > CD> Do you commit it to CVS ? > > No. Last Problem i see is that even when to_string() is available the default > behavior can get called that se

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Marcus Börger
Hello Cristiano, Monday, August 4, 2003, 12:34:23 AM, you wrote: CD> "Marcus BöRger" <[EMAIL PROTECTED]> escreveu na mensagem CD> news:[EMAIL PROTECTED] >> They are simply other types of function just don't care CD> call_user_function_ex() >> will take care of the differences. In other words you

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Cristiano Duarte
"Marcus BöRger" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > They are simply other types of function just don't care call_user_function_ex() > will take care of the differences. In other words you won't need swicth/case. switch/case removed and patch attached. Is it ok? Shoul

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Marcus Börger
Hello Cristiano, Monday, August 4, 2003, 12:10:26 AM, you wrote: CD> Hi Marcus, >> Not good enough it seems :-( CD> I'll get there... ;-) >> Some comments: >> - Please always start with tabs, you used spaces to begin lines. CD> done. seems like :-) >> - TSRMLS_FETCH() is a variable declaratio

Re: Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Cristiano Duarte
Hi Marcus, > Not good enough it seems :-( I'll get there... ;-) > Some comments: > - Please always start with tabs, you used spaces to begin lines. done. > - TSRMLS_FETCH() is a variable declaration, so it cannot be used inside a > function. If I wipe TSRMLS_FETCH() out, I get this error: /usr

Re[2]: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Marcus Börger
Hello Cristiano, Sunday, August 3, 2003, 9:54:55 PM, you wrote: CD> I read README.SUBMITING_PATCH and attached the patch as specified. Not good enough it seems :-( Some comments: - Please always start with tabs, you used spaces to begin lines. - TSRMLS_FETCH() is a variable declaration, so it c

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Cristiano Duarte
I read README.SUBMITING_PATCH and attached the patch as specified. Cristiano Duarte "Cristiano Duarte" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > >"Marcus BöRger" <[EMAIL PROTECTED]> escreveu na mensagem > news:[EMAIL PROTECTED] > > > > The patch doesn't compile (always use

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Cristiano Duarte
>"Marcus BöRger" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > > The patch doesn't compile (always use confugure --enable-maintainer-zts). > Then you assume that every class has a function to_string(), this is not what > we want. > > -- > Best regards, > Marcus

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Sterling Hughes
So, being the author of the C-level cast_object(), I thought about exposing this at one time. I decided against it mainly because I needed it for simplexml, and I didn't want an internals decision to be clouded by userspace discussions (how's my whitespace btw?) I really like the idea of PHP havi

Re: [PHP-DEV] Re: hook cast_object handler in userspace

2003-08-03 Thread Marcus Börger
Hello Cristiano, Sunday, August 3, 2003, 5:33:25 AM, you wrote: CD> I made a patch to the latest PHP5-CVS wich implements this hook. I think CD> it's useful to make a meaningful object stringfied value. CD> Can anyone verify it and maybe commit it to CVS ? CD> --- zend.c 2003-07-30 14:07:36.000

[PHP-DEV] Re: hook cast_object handler in userspace

2003-08-02 Thread Cristiano Duarte
I made a patch to the latest PHP5-CVS wich implements this hook. I think it's useful to make a meaningful object stringfied value. Can anyone verify it and maybe commit it to CVS ? --- zend.c 2003-07-30 14:07:36.0 -0300 +++ zend.c.new 2003-08-03 00:27:43.0 -0300 @@ -227,10 +227,24

[PHP-DEV] Re: hook cast_object handler in userspace

2003-08-02 Thread Cristiano Duarte
Sorry guys, > $o = new xxx(); should be $o = new my_object(); And if there is a way to hook into zend_standard_class (stdClass) what would make all objects inherit the to_string method, it would be great ! Cristiano Duarte "Cristiano Duarte" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL