On 2022-08-22 11:49 AM, David Gebler wrote:

The bit I think I might not like is these being functions, floor_div and
floor_mod. They may be easily confused with the similarly named and
existing fdiv and fmod functions. Wouldn't new operators, // and %%
respectively, be preferable?

Speaking to my preferences, yes, I myself would much prefer these to be
implemented as operators. However, I was looking back at previous
discussions about surrounding `intdiv`, and it was then also proposed
to implement that as an operator (i.e., `%%`) instead of a function.
While implementing the `intdiv` function was approved, the operator
proposal failed. For the same reasons, the operators aren’t being
proposed here, but if there’s a change in attitudes concerning new
operators, that should definitely be on the table.

If we do go down the operator route, however, what tokens should be
chosen? `%%` makes since for floor modulo, but `//` is already used for
comments.

* <https://wiki.php.net/rfc/intdiv>


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to