Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-03-01 Thread jpauli
h this is leading in the > direction of. > > -Clint > > -Original Message- > From: Stas Malyshev [mailto:smalys...@sugarcrm.com] > Sent: Wednesday, February 29, 2012 1:48 AM > To: Anthony Ferrara > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] [Draft

RE: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Clint M Priest
. -Clint -Original Message- From: Stas Malyshev [mailto:smalys...@sugarcrm.com] Sent: Wednesday, February 29, 2012 1:48 AM To: Anthony Ferrara Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers Hi! > Hey all, > > I've created a

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Stas Malyshev
Hi! However, assignment overloading does not seem viable to me. Also, I'm not sure how this is possible technically: $obj = {expression} is supposed to replace $obj with the result of the expression, not call methods on $obj. The engine already calls methods on $obj when that happens. That's

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Richard Lynch
On Tue, February 28, 2012 8:40 pm, Anthony Ferrara wrote: > https://wiki.php.net/rfc/object_cast_magic Suggestion: Rename __castTo as __castObject, to be parallel to engine Question: Is there no need to implement the get() function in userland? It "feels" wrong for 1/3 to be missing, but I probab

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Lazare Inepologlou
Hello Antony, You did a nice work for the RFC. However, I have to disagree with the name __assign, because it limits the type casting operation only to assignments. An implicit type casting could very well happen upon calling a function with type hints. Therefore, I would suggest the use of som

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Anthony Ferrara
Stas, Thanks for the comments! Replies inline: Thanks, Anthony On Wed, Feb 29, 2012 at 2:48 AM, Stas Malyshev wrote: > Hi! > > >> Hey all, >> >> I've created a draft version of the RFC for implementing __castTo() >> and __assign(): >> >> https://wiki.php.net/rfc/object_cast_magic > > > I thin

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Stas Malyshev
Hi! I can think of a few: bridges to foreign types (e.g. Java objects), SimpleXML like libraries and bigint objects, for instance. The RFC has more examples. This all can be (and is) done with engine-level hooks. As I noted in my previous mail, most RFC examples are either exotic (like limite

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-29 Thread Gustavo Lopes
On Wed, 29 Feb 2012 08:48:07 +0100, Stas Malyshev wrote: Hi! Hey all, I've created a draft version of the RFC for implementing __castTo() and __assign(): https://wiki.php.net/rfc/object_cast_magic I think having cast method may have merits, though use cases where objects need to be co

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-28 Thread Stas Malyshev
Hi! Hey all, I've created a draft version of the RFC for implementing __castTo() and __assign(): https://wiki.php.net/rfc/object_cast_magic I think having cast method may have merits, though use cases where objects need to be converted to scalars that aren't string are very limited, and ca

Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-28 Thread Kris Craig
Agreed. Discussion about type hinting/etc should remain on the other topics. Regarding this proposal, I need to look over it in more detail as I've only just skimmed it. But on a conceptual level at least, I think it definitely has merit. --Kris On Tue, Feb 28, 2012 at 6:40 PM, Anthony Ferrar

[PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers

2012-02-28 Thread Anthony Ferrara
Hey all, I've created a draft version of the RFC for implementing __castTo() and __assign(): https://wiki.php.net/rfc/object_cast_magic It's still a draft, and has a lot more work to do, but I figured this would be enough to start triggering some discussion (or at least a little bit more focused