This has already been covered quite a bit, the problem with your suggestion is that the compiler needs to determine the type it is cast to, which is why the __toInt(), __toArray(), etc, so that the language can request the type it needs to cast to.
> -----Original Message----- > From: Seva Lapsha [mailto:seva.lap...@gmail.com] > Sent: Wednesday, May 09, 2012 4:56 PM > To: internals@lists.php.net > Subject: [PHP-DEV] [RFC] Custom Casting > > Hello All, > > Please be kind to review and comment my proposal for custom casting in PHP > (or let me know if a similar proposal was already > discussed). > > http://pastebin.com/sPb0i8U6 > > IMHO, it's more simple and on the other hand more flexible than proposed in: > > https://wiki.php.net/rfc/object_cast_to_types > https://wiki.php.net/rfc/class_casting_to_scalar > > Thank you in advance, > Seva Lapsha > > On Wed, Apr 11, 2012 at 6:14 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > > > Hi all, > > > > I think my RFC confused people on this list due to improper > > descriptions and too much information. Sorry for the confusion. I > > revised the RFC so that most important points can be understood at a glance. > > > > https://wiki.php.net/rfc/nophptags > > > > Please read again if you've read already and give comments. > > Thank you. > > > > -- > > Yasuo Ohgaki > > yohg...@ohgaki.net > > > > -- > > PHP Internals - PHP Runtime Development Mailing List To unsubscribe, > > visit: http://www.php.net/unsub.php > > > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php