Re: [RFC] Add Random Extension (before: Add Random class)
| From: | Larry Garfield | Date: | Sun, 27 Jun 2021 00:20:06 +0000 |
| Subject: | Re: [RFC] Add Random Extension (before: Add Random class) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115163@lists.php.net to get a copy of this message | ||
On Fri, Jun 25, 2021, at 7:39 PM, Go Kudo wrote:
> Hello Internals.
>
> RFC has been reorganized for finalization.
>
> https://wiki.php.net/rfc/rng_extension
>
> The changes from the previous version are as follows:
>
> - Changed again to a class-based approach. The argument can be omitted, in
> which case an instance of XorShift128Plus will be created automatically.
> - Future scope was specified in the RFC and the functionality was separated
> as a Random extension.
> - Changed to separate it as a Random extension and use the appropriate
> namespace.
> - In order to extend the versatility of the final class, Random, a
> RandomInterface has been added, similar in approach to the
> DateTimeInterface.
>
> I've done a tidy implementation to make this final, but I'm currently
> suffering from error detection by Valgrind for unknown reasons.
>
> Implementation is here:
> https://github.com/php/php-src/pull/7079
>
> This can be reproduced with the following code.
This looks a lot nicer!
Question: Why
interface RandomInterface but interface
RandomNumberGenerator? I would expect either both to have an Interface suffix or neither to.
(Preferably neither.)
For that matter, I don't get why RandomInterface exists, if you'll just always use Random
all the time, and it's final.
--Larry Garfield