[PHP-DEV] Type casting syntax

2021-07-10 Thread Max Semenik
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 ")"

Re: [PHP-DEV] Type casting syntax

2021-07-10 Thread Benjamin Morel
> 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_ST

Re: [PHP-DEV] Type casting syntax

2021-07-10 Thread Olle Härstedt
On Sat, 10 Jul 2021, 13:05 Benjamin Morel, 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 t

Re: [PHP-DEV] Type casting syntax

2021-07-10 Thread Marco Pivetta
Hey Max, On Sat, 10 Jul 2021, 11:09 Max Semenik, 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