[PHP-DEV] Re: [RFC] [VOTE] array_find

2024-05-29 Thread Joshua Rüsweg
Hi On 15.05.24 16:52, Joshua Rüsweg wrote: I've just opened the vote for the "array_find" RFC. The RFC contains two votes, each of which requires a 2/3 majority. Voting runs until 2024-05-29 15:00 UTC. Please find the below resources for your reference: RFC: https://w

[PHP-DEV] [RFC] [VOTE] array_find

2024-05-15 Thread Joshua Rüsweg
entation: https://github.com/php/php-src/pull/14108 Discussion Thread: https://externals.io/message/123015 Cheers Joshua Rüsweg

[PHP-DEV] Re: RFC [Discussion]: array_find

2024-05-12 Thread Joshua Rüsweg
2/3 majority for the functions to be implemented. Cheers Joshua Rüsweg

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-05-06 Thread Joshua Rüsweg
Hi On 02.05.24 15:27, Larry Garfield wrote: It's not just that it errors confusingly. It's that the design as is would be incompatible with any C-based function. A function that works with anything *except* the standard library seems... problematic. It's possible that, since these new funct

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-05-01 Thread Joshua Rüsweg
Hi On 01.05.24 12:26, Larry Garfield wrote: This looks good to me, with one remaining exception, which isn't specific to this function but should still be discussed: Always passing the value and key to the callback is unsafe, for two reasons. 1. If the callback is an internal function rather

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-05-01 Thread Joshua Rüsweg
Hi On 19.04.24 23:29, Tim Düsterhus wrote:> Thinking about this: I believe that it would make sense to bundle array_any and array_every (or array_all, see below) within the same RFC due to the similarity. It can be a separate vote for those two, but having the option of getting all three would

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-23 Thread Joshua Rüsweg
Hi On 23.04.24 22:22, Levi Morrison wrote: The RFC looks better to me. The [Unaffected PHP Functionality][1] section looks like it needs updating, though: This RFC only adds two new functions and an enum to PHP and only affects previously defined functions which are named as the proposed funct

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-23 Thread Joshua Rüsweg
Hi On 19.04.24 21:20, Joshua Rüsweg wrote: I definitely see the point where there is an advantage to having two separate methods and can definitely understand that it is easier for developers to understand the control flow without evaluating the parameters. I'm unsure if that

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-23 Thread Joshua Rüsweg
Hi On 19.04.24 23:17, Tim Düsterhus wrote: On 4/19/24 22:08, Larry Garfield wrote: There's another issue, though: Will the callback always be given both $value and $key? The current implementation always passes both, which, as I just learned, is inconsistent with `array_filter` which has th

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-19 Thread Joshua Rüsweg
Hi On 10.04.24 00:12, Larry Garfield wrote: Another alternative is to always return the key, because you can trivially get the value from the key, but not vice versa. Of course, the resulting syntax for that is frequently fugly. $val = $array[array_find($db, $array)] ?? some-default; In 9

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-19 Thread Joshua Rüsweg
On 11.04.24 03:03, Levi Morrison wrote: IMO, it's better to separate it into two functions because its type is stable without control flow. For instance: // Returns K if $b is true, V otherwise. function array_find( array $array, callable(V, K): bool $callback,

Re: [PHP-DEV] RFC [Discussion]: array_find

2024-04-07 Thread Joshua Rüsweg
turn-mode Enum would make more sense here. I like the idea, thank you! However, I am unsure whether an additional enum for the function would not be too much overhead. Cheers Joshua Rüsweg

[PHP-DEV] RFC [Discussion]: array_find

2024-04-07 Thread Joshua Rüsweg
. You can find the RFC at: https://wiki.php.net/rfc/array_find Proof of concept implementation is in: https://github.com/joshuaruesweg/php-src/commit/9f3fc252b92f534d498e5f1e6a463e15f45da208 I'm looking forward to your feedback. Cheers Joshua Rüsweg

[PHP-DEV] Re: RFC [Discussion]: Randomizer Additions

2022-11-07 Thread Joshua Rüsweg via internals
concludes. Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] RFC [Discussion]: Randomizer Additions

2022-10-28 Thread Joshua Rüsweg via internals
From` sounds incomplete to me. `getBytesFromList` sounds to me as if an array is being passed there and not a string. `getBytesFromString` sounds good to me, though. Better than `getBytesfromAlphabet`! Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

[PHP-DEV] Re: RFC [Discussion]: Randomizer Additions

2022-10-28 Thread Joshua Rüsweg via internals
the getFloat method with a parameter that specifies which type of interval should be generated (Open, Closed, Right Half-Open and Left Half-Open). Are you happy with the enum names? Have you any other suggestions? Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] RFC [Discussion]: Randomizer Additions

2022-10-15 Thread Joshua Rüsweg via internals
not done and it only causes confusion if any functions are introduced after the feature freeze. In the end, however, I think it is the release manager who decides. Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

[PHP-DEV] RFC [Discussion]: Randomizer Additions

2022-10-13 Thread Joshua Rüsweg via internals
parameter? Enum? We're looking forward to your feedback. Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

[PHP-DEV] Pre RFC - Additions to the randomizer

2022-10-05 Thread Joshua Rüsweg via internals
/php/php-src/pull/9664 [3] https://github.com/php/php-src/pull/9679 PS: Since this is my first contribution, someone needs to give me karma to open an RFC. My account name is `josh`. Cheers Joshua Rüsweg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www