Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-20 Thread Ben Ramsey
> On Dec 19, 2020, at 19:43, tyson andre > wrote: > > It can be useful to verify that the assumption that array keys are > consecutive integers is correct, both for data that is being passed > into a module or for validating data before returning it from a > module. However, because it's currentl

Re: [PHP-DEV] Re: Straw poll: Naming for `*any()` and `*all()` on iterables

2020-12-20 Thread tyson andre
Hi Mark Randall, > These functions make sense. However I think we need to give renewed > consideration to: > > $itr->all(); > $itr->some(...); That wouldn't help for arrays, which would be the most common use case - I don't remember seeing an RFC for https://github.com/nikic/scalar_objects and

[PHP-DEV] Re: Straw poll: Naming for `*any()` and `*all()` on iterables

2020-12-20 Thread Mark Randall
On 19/12/2020 20:24, tyson andre wrote: Hi internals, I've created a straw poll for the naming pattern to use for `*any()` and `*all()` on iterables. https://wiki.php.net/rfc/any_all_on_iterable_straw_poll These functions make sense. However I think we need to give renewed consideration to:

[PHP-DEV] [RFC] Configurable callback to dump results of expressions in `php -a`

2020-12-20 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/readline_interactive_shell_result_function adding a way to configure a callback to be called to dump the value of single-expression statements from `php -a` (and an ini setting that can be disabled to prevent that callback from being

Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-20 Thread Josh Bruce
I appreciate this idea as I ran into the same issue with one of my libraries when I wrote similar rules. Granted, I’m using “array” and “dictionary” not “list” as both terms seem common to the community and used to distinguish the two. But that’s semantics, which I’m sure will be discussed at

Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-20 Thread tyson andre
Hi Larry Garfield, > Well, since I'm quoted... :-) > > I'm fine with this, but have one question and one correction: > > * If we do eventually end up with list/vec types, would the naming here > conflict at all?  Or would it cause confusion and name collision?  (Insert > name bikeshedding here

Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays

2020-12-20 Thread Larry Garfield
On Sat, Dec 19, 2020, at 7:43 PM, tyson andre wrote: > Hi internals, > > I've created the RFC https://wiki.php.net/rfc/is_list > > This adds a new function `is_list(mixed $value): bool` that will return > true > if the type of $value is array and the array keys are `0 .. > count($value)-1` in t

Re: [PHP-DEV] Re: Improving PRNG implementation.

2020-12-20 Thread Max Semenik
On Sun, Dec 20, 2020 at 6:45 AM zeriyoshi wrote: > Thanks cmb. I have created a first draft of an RFC. I think I've covered > all the necessary requirements, but I'd like to know if there are any > problems. > https://wiki.php.net/rfc/object_scope_prng A few IMHO comments: * Namespaces are cont

[PHP-DEV] Re: Improving PRNG implementation.

2020-12-20 Thread Christoph M. Becker
On 20.12.2020 at 04:45, zeriyoshi wrote: > On 19.12.2020 at 11:26, Christoph M. Becker wrote: > >> RFC karma granted. Best of luck with the RFC! :) > > Thanks cmb. I have created a first draft of an RFC. I think I've covered > all the necessary requirements, but I'd like to know if there are any

Re: [PHP-DEV] [RFC] Short-match

2020-12-20 Thread Olle Härstedt
On Sat, 19 Dec 2020, 02:48 Larry Garfield, wrote: > On Fri, Dec 18, 2020, at 1:40 PM, Olle Härstedt wrote: > > What about matching on a variable's type? > > > > ``` > > match { > > $var: string => "is a string" > > $var: array => "something else" > > } > > ``` > > > > This could be used with