Re: Type casting syntax

From: Date: Sat, 10 Jul 2021 11:10:01 +0000
Subject: Re: Type casting syntax
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-115384@lists.php.net to get a copy of this message
On Sat, 10 Jul 2021, 13:05 Benjamin Morel, <benjamin.morel@gmail.com> wrote: > > I've been thinking about extending PHP's cast syntax to user-defined > types, > > e.g. not only (int)$foo but also (MyClass)$foo. Currently, a T_STRING in > > parentheses is always treated as a constant - would it be acceptable to > > hijack this syntax when used in unary operation context, i.e. "(" > T_STRING > > ")" expr? If not, any other alternatives? > > > Hi, I proposed something similar a while back, you might want to have a > look at this discussion: > > https://externals.io/message/105332#105367 > > - Benjamin > Maybe start filling the holes for built-in types? Callable... Olle >

« previous php.internals (#115384) next »