Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2023-12-14 Thread G. P. B.
On Wed, 13 Dec 2023 at 09:29, Alexander Pravdin wrote: > On Wed, Dec 13, 2023 at 6:11 PM Robert Landers > wrote: > > I just ran `apt install php8.3-decimal` and tried this: > > > > $a = new Decimal\Decimal("1", 2); > > $b = $a + $a; > > PHP Warning: Uncaught TypeError: Unsupported operand

Re: [PHP-DEV] Proposal: Arbitrary precision native scalar type

2023-12-14 Thread G. P. B.
On Tue, 12 Dec 2023 at 21:00, Robert Landers wrote: > On Tue, Dec 12, 2023 at 2:04 PM G. P. B. wrote: > > GMP supports operator overloading > > GMP kinda-sorta-most-of-the-time supports operator overloading. > Sometimes ... it doesn't. I implemented a field library in PHP (for > work a couple

Re: [PHP-DEV] Are warnings guaranteed?

2023-12-14 Thread Niels Dossche
Hi On 14/12/2023 11:39, petrov.boris.v.mail.ru via internals wrote: > Is relying on warnings being converted to exceptions by error handler is > equivalent to checking return value with regards to the set of error > conditions covered? If this guarantee is already there, please point to me to

Re: [PHP-DEV] Are warnings guaranteed?

2023-12-14 Thread Marco Pivetta
Hey Boris, On Thu, 14 Dec 2023 at 11:39, petrov.boris.v.mail.ru via internals < internals@lists.php.net> wrote: > The above code confuses a reader with issues 1) isn't the only possible > return value is now true? 2) if it throws on failure, then how can it > return anything? > Just worth

[PHP-DEV] Are warnings guaranteed?

2023-12-14 Thread petrov.boris.v.mail.ru via internals
Hi. I have a question: Is there a formal rule in PHP standard library that any function which returns false as a mean to signify a failure does also issue a warning? In many codebases warnings are converted to an exception by means of set_error_handler(). Example 1