Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Seva Lapsha
nday, May 14, 2012 12:19 PM > > *To:* Clint Priest > *Cc:* internals@lists.php.net > *Subject:* Re: [PHP-DEV] [RFC] Custom Casting > > ** ** > > My pastbin is for casting anything to anything. > > On Mon, May 14, 2012 at 11:24 AM, Clint Priest > wrote:

RE: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Clint Priest
How would one use your Castable interface to cast a Class "Test" to any of integer, array or boolean? From: Seva Lapsha [mailto:seva.lap...@gmail.com] Sent: Monday, May 14, 2012 12:19 PM To: Clint Priest Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Custom Casting My past

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Seva Lapsha
Thanks. On Mon, May 14, 2012 at 2:28 PM, Stas Malyshev wrote: > Hi! > > > Not quite. The proposed is a syntactic sugar which is thought to handle > > any transformation of a value, not necessarily or limited to type or > > class conversion. It is of course possible to limit the usage to just > >

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Stas Malyshev
Hi! > Not quite. The proposed is a syntactic sugar which is thought to handle > any transformation of a value, not necessarily or limited to type or > class conversion. It is of course possible to limit the usage to just > that, with any user defined convention or "best practice". In fact it's > p

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Seva Lapsha
> From: Seva Lapsha [mailto:seva.lap...@gmail.com] > Sent: Monday, May 14, 2012 6:18 AM > To: Clint Priest > Cc: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Custom Casting > > Sorry, I comprehend neither the cause nor the effect in your argument > statement. Can

RE: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Clint Priest
rnals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Custom Casting Sorry, I comprehend neither the cause nor the effect in your argument statement. Can you please elaborate? On Sun, May 13, 2012 at 7:27 PM, Clint Priest wrote: > This has already been covered quite a bit, the problem with your > suggest

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Seva Lapsha
Hi, Not quite. The proposed is a syntactic sugar which is thought to handle any transformation of a value, not necessarily or limited to type or class conversion. It is of course possible to limit the usage to just that, with any user defined convention or "best practice". In fact it's pretty dist

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-14 Thread Seva Lapsha
Sorry, I comprehend neither the cause nor the effect in your argument statement. Can you please elaborate? On Sun, May 13, 2012 at 7:27 PM, Clint Priest wrote: > This has already been covered quite a bit, the problem with your > suggestion is that the compiler needs to determine the type it is c

Re: [PHP-DEV] [RFC] Custom Casting

2012-05-13 Thread Stas Malyshev
Hi! > 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 I think there's an issue with this idea. As far as I understand, what is proposed is kind of cast-constructor paradigm

RE: [PHP-DEV] [RFC] Custom Casting

2012-05-13 Thread Clint Priest
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 Laps