Re: Proposal: Type Casting User Classes
| From: | Rowan Collins | Date: | Fri, 15 Nov 2013 15:28:52 +0000 |
| Subject: | Re: Proposal: Type Casting User Classes | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70157@lists.php.net to get a copy of this message | ||
Chris London wrote (on 15/11/2013):
To me, since PHP already has implemented type casting to (int), (string), (bool), etc. the value in type casting is already there. I just want to take it to the next level.Actually, PHP has so far avoided *user-defined* casts to anything other than string. Extensions can implement objects with magic cast semantics for other types, but only __toString() can be implemented in user-space, and proposals for more general casting mechanisms seem to have met with resistance. Whether or not that's a discussion people are willing to re-visit, I have no idea. Regards, -- Rowan Collins [IMSoP]