[PHP-DEV] Re: Planning an RFC to allow calls to global functions in constant expressions

2020-02-08 Thread tyson andre
Hi internals, > I have a working implementation for calling global functions in constant > expressions > at https://github.com/php/php-src/pull/5139 > (see PR description for more details, see tests for how edge cases get > resolved) I've written up an early draft of this based on https://wi

Re: [PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-08 Thread tyson andre
> As you've already realized, the main problem here is the behavior for > functions that have side-effects or state. Currently we mostly get away > with the illusion that it doesn't matter when exactly constexpr > initializers are evaluated. Apart from the error location and (admittedly > quite a f

Re: [PHP-DEV] Operator overloading for userspace objects

2020-02-08 Thread Rowan Tommins
On 06/02/2020 20:06, Andrea Faulds wrote: Haskell has a nice approach (probably some other languages have this too) where it has typeclasses that contain related operators, which means that e.g. if you want to overload +, your type needs to support Num which also contains -, *, abs, the sign fu