Skip to content

[RFC] Random extension #7453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

Conversation

zeriyoshi
Copy link
Contributor

tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be dropped, top-level .gitignore should be enough.

namespace
{

function lcg_value(): float {}
Copy link
Member

@nikic nikic Sep 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these functions being moved? This part of the change doesn't look necessary to me. Does keeping these functions in ext/standard cause any problems?


function random_int(int $min, int $max): int {}

final class Random
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I saw, our namespace policy doesn't have a guideline about this, but in my opinion, it would be better to put this class into the Random namespace.

namespace Random
{

abstract class NumberGenerator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about making NumberGenerator an interface instead, since it doesn't have any behavior? It would be useful IMO, since userland implementations could extend whatever they want.

  • I'd put the interface into the Random\NumberGenerator namespace.

@andypost
Copy link
Contributor

As I got this extensions can't be build as shared?

@andypost
Copy link
Contributor

andypost commented Sep 23, 2021

There's typo at https://wiki.php.net/rfc/rng_extension
Random\NumberGenrator abstract class should be NumberGenerator

@zeriyoshi
Copy link
Contributor Author

Close to restructure this RFC and implementation.

@zeriyoshi zeriyoshi closed this Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants