Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[RFC] Random extension#7453

Closed
zeriyoshi wants to merge 6 commits into
php:masterphp/php-src:masterfrom
zeriyoshi:random_extensionzeriyoshi/php-src:random_extensionCopy head branch name to clipboard
Closed

[RFC] Random extension#7453
zeriyoshi wants to merge 6 commits into
php:masterphp/php-src:masterfrom
zeriyoshi:random_extensionzeriyoshi/php-src:random_extensionCopy head branch name to clipboard

Conversation

@zeriyoshi
Copy link
Copy Markdown
Contributor

Comment thread ext/random/.gitignore
tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@andypost
Copy link
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.