Re: [PHP-DEV] ARRAY_UNIQUE_IDENTICAL option

2022-11-07 Thread tyson andre
Hi Levi Morrison, > A bit off topic, but not entirely: > > In my opinion, adding another flag isn't the _real_ fix. Any function > which does comparisons should take a callable for users to provide any > comparison they wish. An iteratively better API would be: > >     function array_unique(list $

[PHP-DEV] Proposal: Expanded iterable helper functions and aliasing iterator_to_array in `iterable\` namespace

2022-10-28 Thread tyson andre
Hi internals, https://wiki.php.net/rfc/iterator_xyz_accept_array recently passed in php 8.2, fixing a common inconvenience of those functions throwing a TypeError for arrays. However, from the `iterator_` name (https://www.php.net/manual/en/class.iterator.php), it's likely to become a source of

Re: [PHP-DEV] Microseconds to error log

2022-10-28 Thread tyson andre
Hi Mikhail, > >Basically, we have quite a high-loaded environment and we really want > >to see timestamps containing milli-/microseconds in our logs. > > I'm not knowledgeable enough to comment on the implementation details, but > from a user point of view I agree the feature would be useful. It

Re: [PHP-DEV] Adding the OpenSSF Scorecards GitHub Action

2022-10-27 Thread tyson andre
Hi Pedro Nacht, > Hello, I'm working on behalf of Google and the Open Source Security > Foundation to help essential open-source projects improve their supply-chain > security. Could you expand on that? It isn't obvious from your comment, and I'm curious about this initiative at Google. 1. H

[PHP-DEV] Adding `class UnsupportedOperationException extends RuntimeException` to php?

2022-02-13 Thread tyson andre
Hi internals, Currently, there doesn't seem to be an exact fit for indicating that a method isn't supported on an object by design (and will throw unconditionally). (For example, when implementing an interface or overriding a base class, e.g. an Immutable datastructure not implementing offsetSet

[PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-05 Thread tyson andre
Hi internals, > > > I've created a new RFC https://wiki.php.net/rfc/deque to add a `final > > > class Deque` > > > > > > This is based on the `Teds\Deque` implementation I've worked on > > > for the https://github.com/TysonAndre/pecl-teds PECL. > > > > > > While `SplDoublyLinkedList` and its subc

[PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-04 Thread tyson andre
Hi internals, > > I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class > > Deque` > > > > This is based on the `Teds\Deque` implementation I've worked on > > for the https://github.com/TysonAndre/pecl-teds PECL. > > > > While `SplDoublyLinkedList` and its subclass `SplQueue

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Larry Garfield, > >> Returning $this would resolve that, I think.  (Making it return a new, > >> immutable copy of the Deque would be even nicer, but I realize that's > >> probably not an argument I'm going to win at this point on this RFC.) > > > > Technically, you still can have single-expr

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Jordan, > > 4.  Returning $this makes code easier to write at some cost to readability > > - Developers new to php or using `Collections\Deque` for the first time > > would not immediately know what the code they're reading is doing. > >    (less of a problem with a good IDE, typechecker, and

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Stephen, > As a userland dev & library author it’s nice to see some progression on basic > data structures, so thank you for your efforts on this! > > > Two little things in the RFC: > > The proposed API switches between terms `front`, `back`, `start` and `end` in > comments - is there mea

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Larry Garfield, > Request: > > push() and unshift() currently return void. That's not helpful. It would be > vastly more useful if they both returned $this. Not as much for chaining, > but more so that you can add a value to a queue and pass it as an argument to > another call (often recu

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Mel Dafert, > >The proposed API switches between terms `front`, `back`, `start` and `end` > >in comments - is there meant to be a conceptual difference between > >front/start and end/back ? > > On a similar note, why are the methods for getting the first/last value called > `top()`/`bottom()

[PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-01 Thread tyson andre
Hi internals, > I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class > Deque` > > This is based on the `Teds\Deque` implementation I've worked on > for the https://github.com/TysonAndre/pecl-teds PECL. > > While `SplDoublyLinkedList` and its subclass `SplQueue`/`SplStack`

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-02-01 Thread tyson andre
Hi Levi Morrison, > I think this RFC is in much better shape now. > > The last thing I'll personally push for is dropping `get` and `set`. > I'm not sure about those names, and the functionality is already > provided by `offsetGet` and `offsetSet`, albeit through `mixed` > instead of `int`, but I

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-01-31 Thread tyson andre
> > The name "deque" is used in the standard library of these languages: > > > >  - C++: std::deque > >  - Java: java.util.Deque (interface) > >  - Python: collections.deque > >  - Swift: Collections.Deque (not standard lib, apparently, but Apple > > official? Don't know Swift) > >  - Rust: std::co

[PHP-DEV] [VOTE] Straw poll: Naming pattern to use for Deque RFC

2022-01-12 Thread tyson andre
Hi internals, Voting has started on https://wiki.php.net/rfc/deque_straw_poll , to gather feedback on the following options: 1. `\Deque`, the name currently used in the RFC/implementation. See https://wiki.php.net/rfc/deque#global_namespace This was my preference because it was short, m

Re: [PHP-DEV] (Planned) Straw poll: Naming pattern for `*Deque`

2022-01-11 Thread tyson andre
Hi Pierre, > > While there is considerable division in whether or not members of internals > > want to adopt namespaces, > > I hope that the final outcome of the poll will be accepted by members of > > internals > > as what the representative of the majority of the members of internals > > (from

[PHP-DEV] Re: (Planned) Straw poll: Naming pattern for `*Deque`

2022-01-09 Thread tyson andre
Hi internals, > Because the naming choice for new datastructures is a question that has been > asked many times, > I plan to create another straw poll (Single transferrable vote) on > wiki.php.net to gather feedback on the naming pattern to use for future > additions of datastructures to the SP

Re: [PHP-DEV] Cache zend_function*

2021-11-30 Thread tyson andre
Hi Glash Gnome, > I'm doing the Cairo C API extension. > Also there is a wrapper written in php for the OOP side( example: > https://github.com/gtkphp/gtkphp/blob/main/lib/Cairo/Context.php) > > So far, so good. > > Now let's do the same thing with Gtk, > (https://github.com/gtkphp/gtkphp/blob/

Re: [PHP-DEV] PHP 8.1 and PECL ext builds for Windows

2021-11-14 Thread tyson andre
Hi internals, > > Removing the centralized PECL builder and dependency manager would most > > likely lead to a huge regression in the support and manageability. Right > > now there's one place pecl.php.net to go for the non core extension builds > > and any dependencies are guaranteed to be non

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-10-04 Thread tyson andre
Hi Nikita Popov, > 1. There would be the possibility of having an interface Deque that is > backed by a VecDeque/ArrayDeque implementation. I'm not convinced this > would actually make sense, but I wanted to throw it out there, given that > the class is final (which is without any doubt the correc

Re: [PHP-DEV] Unified ReflectionType methods

2021-10-02 Thread tyson andre
Hi Andreas, > Hello list, > I would like to propose new methods for ReflectionType, that would > allow treating ReflectionNamedType and ReflectionUnionType in a > unified way. > This would eliminate the need for if (.. instanceof) in many use cases. > > Some details can still be discussed, e.g. w

Re: [PHP-DEV] Allowing `(object)['key' => 'value']` in initializers?

2021-09-25 Thread tyson andre
Hey Marco Pivetta, > > What are your thoughts on allowing the `(object)` cast in initializer types > > where `new` was already allowed, but only when followed by an array literal > > node. (e.g. continue to forbid `(object)SOME_CONSTANT`) (see > > https://wiki.php.net/rfc/new_in_initializers) >

[PHP-DEV] Allowing `(object)['key' => 'value']` in initializers?

2021-09-25 Thread tyson andre
Hi internals, In PHP 8.1, it is possible to allow constructing any class name in an initializer, after the approval of https://wiki.php.net/rfc/new_in_initializers ``` php > static $x1 = new ArrayObject(['key' => 'value']); php > static $x2 = new stdClass(); php > static $x3 = (object)['key' =

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-21 Thread tyson andre
Hi Levi Morrison, > > "Maximum size" shouldn't be an issue for `Deque` specifically, it's a > > `size_t`. It isn't an issue for SplFixedArray and ArrayObject. > > (or for > > PHP would just encounter a fatal error due to either > > You wrote a lot, but unfortunately it was based on a misundersta

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-21 Thread tyson andre
Hi Mike Shinkel, > >> Hmm. I must have missed that thread as I was definitely following the list > >> at that time. > >> > >> But I found the thread, which only had three (3) comments from others: > >> > >> https://externals.io/message/112639 > >> > >> From Levi Morrison it seems his objectio

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-21 Thread tyson andre
Hi Levi Morrison, > The name "deque" is used in the standard library of these languages: > > - C++: std::deque > - Java: java.util.Deque (interface) > - Python: collections.deque > - Swift: Collections.Deque (not standard lib, apparently, but Apple > official? Don't know Swift) > - Rust: std

[PHP-DEV] (Planned) Straw poll: Naming pattern for `*Deque`

2021-09-20 Thread tyson andre
Hi internals, Because the naming choice for new datastructures is a question that has been asked many times, I plan to create another straw poll (Single transferrable vote) on wiki.php.net to gather feedback on the naming pattern to use for future additions of datastructures to the SPL, with th

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-20 Thread tyson andre
Hi Peter Bowyer, > That is a fair point. Vector is an overloaded and common word. For me a > vector will always default to an entity characterized by a magnitude and a > direction, because that's what I learned and used for years. The next > definition I learned was the Numpy one. > > That for me

Re: [PHP-DEV] Adding `final class Deque` to PHP

2021-09-20 Thread tyson andre
Hi Pierre, > It seems that you are writing more than one RFC to add many data > structures. I love that you're doing that, but I suggest that you'd > normalize them all I'm not certain what you mean by "normalize". https://www.merriam-webster.com/dictionary/normalize mentions 1. "to make confo

[PHP-DEV] Adding `final class Deque` to PHP

2021-09-19 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/deque to add a `final class Deque` This is based on the `Teds\Deque` implementation I've worked on for the https://github.com/TysonAndre/pecl-teds PECL. While `SplDoublyLinkedList` and its subclass `SplQueue`/`SplStack` exist in the

[PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values

2021-09-19 Thread tyson andre
Hi internals, Currently, array_filter will always return the original keys. This often requires an additional wrapping call of array_values(array_filter(...)) to reindex the keys and return a list. (or applications may not realize there will be gaps in the keys until it causes a bug or unexpecte

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-19 Thread tyson andre
Hi Mike Schinkel, > >> Given there seems to be a lot of concern about the approach the RFC > >> proposes would it not address the concerns about memory usage and > >> performance if several methods were added to SplFixedArray instead (as > >> well as functions like indexOf(), contains(), map()

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-18 Thread tyson andre
Hi Mike Schinkel, > Given there seems to be a lot of concern about the approach the RFC proposes > would it not address the concerns about memory usage and performance if > several methods were added to SplFixedArray instead (as well as functions > like indexOf(), contains(), map(), filter(), J

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-18 Thread tyson andre
Hi Larry Garfield, > Rather than go point by point, I'm going to respond globally here. > > I am frequently on-record hating on PHP arrays, and stating that I want > something better.  The problems with PHP arrays include: > > 1. They're badly performing (because they cannot be optimized) > 2.

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-18 Thread tyson andre
Hi Peter Bowyer, > > > To echo Pierre, a Vector needs to be of a single guaranteed type. > > > Yes, this gets us back to the generics conversation again, but I presume > > (perhaps naively?) there are ways to address this question without getting > > into full-blown generics. > > > > Yep, as you s

Re: [PHP-DEV] Make strtolower/strtoupper just do ASCII

2021-09-18 Thread tyson andre
Hi Tim Starling,   > I would like to know if a patch to make strtolower and strtoupper do > plain ASCII case conversion would be accepted, or if an RFC should be > created. > > The situation with case conversion is inconsistent. > > The following functions do ASCII case conversion: strcasecmp, >

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
Hi Pierre Joye, > Not sure you care or read my reply but I had to jump in one more time here :) > > On Sat, Sep 18, 2021 at 8:49 AM tyson andre wrote: > > > setSize is useful in allocating exactly the variable amount of memory > > needed while using less memory than a

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
> Improving collection/set operations in PHP is something near and dear to my > heart, > so I'm in favor of adding a Vector class or similar to the stdlib. > > However, I am not a fan of this particular design. > > As Levi noted, this being a mutable object that passes by handle is asking > fo

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
Hi Max Semenik, > Since Ds was mentioned, I've added it to your benchmark (code and complete > results at https://gist.github.com/MaxSem/d0ea0755d6deabaf88c9ef26039b2f27): > > Appending to array:         n= 1048576 iterations=      20 memory=33558608 > bytes, create+destroy time=0.369 read time

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
Hi Christian Schenider, > First of all: I don't have a strong opinion on a Vector class being useful or > necessary. > > But I have two comments about this RFC: > > 1. Using the very generic name Vector without any prefix/namespace seems > dangerous and asking for BC breaks. I downloaded the

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
Hi Levi Morrison, > I mean that there isn't a way to provide a custom way to compare for > equality. One way to accomplish this is to have a signature like: > >    function contains(T $value, ?callable(T, T):bool $comparator = null): bool > > The same goes for `indexOf`. It'd make much more sen

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-17 Thread tyson andre
Hi Pierre, > That's nice, and I like it, but like many people I will argue about the > API itself. > > One thing is that there's many methods in there that would totally fit > generic collection common interfaces, and in that regard, I'd be very > sad that it would be merged as is. It isn't an

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-16 Thread tyson andre
Hey Marco Pivetta, > Would it perhaps make sense to drag in php-ds, which has matured quite a bit > over the years? I'm referring to:  > https://www.php.net/manual/en/class.ds-sequence.php > > Is what you are suggesting with `Vector` different from it? > > Note: For some reason, I can't quote y

Re: [PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-16 Thread tyson andre
Hi Levi Morrison, > I'm okay with a final Vector class in general. I don't love the > proposed API but don't hate it either. Feedback on that at the end. > > What I would _love_ is a `vec` type from hacklang, which is similar to > this but pass-by-value, copy-on-write like an array. Of course, th

[PHP-DEV] RFC: Add `final class Vector` to PHP

2021-09-16 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/vector proposing to add `final class Vector` to PHP. PHP's native `array` type is rare among programming language in that it is used as an associative map of values, but also needs to support lists of values. In order to support both

Re: [PHP-DEV] [RFC] Deprecate dynamic properties

2021-08-25 Thread tyson andre
Hi Nikita Popov, > I'd like to propose the deprecation of "dynamic properties", that is > properties that have not been declared in the class (stdClass and > __get/__set excluded, of course): > > https://wiki.php.net/rfc/deprecate_dynamic_properties > > This has been discussed in various forms i

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

2021-07-19 Thread tyson andre
Hi Craig Francis, > As an aside, only 4 of 23 'no' voters provided any comment as to why they > voted that way on the mailing list, which I feel undermines the point of > the Request For Comment process, with an additional 5 responding personally > off-list after prompting. This makes it harder (o

Re: [PHP-DEV] Changing method naming in FFI Type Reflection API from Arg->Parameter, etc

2021-07-13 Thread tyson andre
> > The FFI Type Reflection API mentioned in > > https://externals.io/message/115336 was recently added > > > > My opinion is that that they should be renamed to use the same naming > > scheme that PHP's Reflection extension is already using. > > Having different ways of naming very similar conc

[PHP-DEV] Changing method naming in FFI Type Reflection API from Arg->Parameter, etc

2021-07-13 Thread tyson andre
Hi internals, The FFI Type Reflection API mentioned in https://externals.io/message/115336 was recently added My opinion is that that they should be renamed to use the same naming scheme that PHP's Reflection extension is already using. Having different ways of naming very similar concepts (dif

Re: [PHP-DEV] [RFC] clamp

2021-06-23 Thread tyson andre
Hello Kim Hallberg, > The RFC for the clamp function is now open and under discussion, you now have > 2 weeks > to discuss, suggest improvements and open issues before voting is considered. >From https://wiki.php.net/rfc/clamp - > Current userland implementations are handled in several ways,

Re: [PHP-DEV] [RFC] clamp

2021-06-23 Thread tyson andre
Hi Kim Hallberg, > The RFC for the clamp function is now open and under discussion, you now have > 2 weeks > to discuss, suggest improvements and open issues before voting is considered. > > Any and all feedback is welcomed. > > The RFC is available for viewing here: https://wiki.php.net/rfc/c

Re: [PHP-DEV] [Vote] make Reflection*#setAccessible() no-op

2021-06-23 Thread tyson andre
Mi Marco Pivetta, > I'm opening the vote for making `Reflection*#setAccessible()`. > > Voting starts today (2021-06-23) and ends in 14 days (2021-07-07). > > Vote at https://wiki.php.net/rfc/make-reflection-setaccessible-no-op > > Discussion: https://marc.info/?l=php-internals&m=162360269505048

Re: [PHP-DEV] [RFC] Deprecate boolean to string coercion

2021-06-22 Thread tyson andre
Hi George P. Banyard, > With Ilija we are proposing a short RFC to deprecate coercion from bool to > string: > https://wiki.php.net/rfc/deprecate-boolean-string-coercion > > As this is the final day for any RFC to be even able to land in PHP 8.1 > the voting is expected to start in two weeks on t

Re: [PHP-DEV] [PROPOSAL] Bare name array literals (again)

2021-06-21 Thread tyson andre
Hi Mel Dafert, > >I would prefer an improved syntax for creation of anonymous objects. This > >is something which I have been annoyed with, myself.I'd like to see a > >simple way of creating anonymous objects with typed properties. > > Another advantage arrays currently have over anonymous object

Re: [PHP-DEV] [PROPOSAL] Bare name array literals (again)

2021-06-21 Thread tyson andre
Hi Christian Schneider, > > return [success: true, data: $data, cursor: $cursor]; > > // is equivalent to the following, but shorter: > > return ['success' => true, 'data' => $data, 'cursor' => $cursor]; > > Just a little side-note: A while ago I proposed a 2-line-patch to allow :$foo > as a syn

Re: [PHP-DEV] [PROPOSAL] Bare name array literals (again)

2021-06-21 Thread tyson andre
Hi Rowan Tommins, > This is an immediate "no" from me: it multiplies the ways to write the > same thing from 2 to 4, in order to save a few bytes, in a few instances. It's from 4 to 6 if you include single quoted strings vs double quoted strings. If linters and automatic fixers were set up for a

[PHP-DEV] [PROPOSAL] Bare name array literals (again)

2021-06-21 Thread tyson andre
Hi internals, In every place where `key` is a valid php identifier (e.g. can be used in PHP 8.0's named parameters), I propose to allow `[key: expr]` to be used instead of `['key' => expr]`. (including `list(key: expr)` and `array(key: expr)` (This can be mixed anywhere with existing key/value syn

Re: [PHP-DEV] [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

2021-06-17 Thread tyson andre
Hi Larry Garfield, Thanks for responding. > While I like the idea of an immutable collection, and the performance boost > seems useful, this proposal seems to go about it in a sloppy way. > > 1) Iterable doesn't seem like the right "family" for this. It is iterable, > but so are lots of other

Re: [PHP-DEV] [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

2021-06-16 Thread tyson andre
Hi Nikita, > I like the concept here. I think the naming choice is unfortunate, and > causing confusion for people. > > What you're really proposing here is a data structure: A sequence of > key-value-pairs. That generally seems like a sensible thing to have, in that > we can implement it sign

Re: [PHP-DEV] [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

2021-06-15 Thread tyson andre
Hi Thomas Bley, > Maybe better use "IterableImmutable" to be more consistent with > "DateTimeImmutable"? 1. Replies won't show up on list if they aren't sent to internals@lists.php.net 2. I consider the name DateTimeImmutable a mistake (but one that isn't worth fixing). If it was done from

Re: [PHP-DEV] [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

2021-06-15 Thread tyson andre
Hi Marco Pivetta, > I see the RFC as valuable but: > > * `__serialize` and `__unserialize` are out of scope: this depends on the >contents of it, and there's no point in implementing them > * `__set_state` should also not be implemented: `var_export()` like any other >object and it should be fi

[PHP-DEV] [VOTE] ImmutableIterable (immutable, rewindable, allows any key&repeating keys)

2021-06-15 Thread tyson andre
Hi internals, Voting has started on the ImmutableIterable RFC https://wiki.php.net/rfc/cachediterable Previous discussion can be found in https://externals.io/message/114834 Recent changes: - The name was renamed to `ImmutableIterable` to indicate that it cannot be changed after being construc

Re: [PHP-DEV] [RFC] make Reflection*#setAccessible() no-op

2021-06-13 Thread tyson andre
Hi Marco Pivetta, > I'm posting here to introduce a new simplification, as well as > quality-of-life-improving RFC: > > https://wiki.php.net/rfc/make-reflection-setaccessible-no-op > > The RFC is quite minimal, and proposes removing any runtime behavior from > `ReflectionMethod#setAccessible()`

Re: [PHP-DEV] Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-06-12 Thread tyson andre
Hi internals, > > > So I'm probably changing this to `ImmutableTraversable` as a short name > > > for the functionality, > > > to make it clear arguments are eagerly evaluated when it is created. > > > (ImmutableSequence may be expected to only contain values, and would be > > > confused with th

Re: [PHP-DEV] Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-06-10 Thread tyson andre
Hi Alex, > > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > > CachedIterable, > > which eagerly evaluates any iterable and contains an immutable copy of the > > keys and values of the iterable it was constructed from > > > > A heads up - I will probably start voting on

Re: [PHP-DEV] Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-06-09 Thread tyson andre
Hi Levi Morrison, > > > Hi internals, > > > > > > > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > > > > CachedIterable, > > > > which eagerly evaluates any iterable and contains an immutable copy of > > > > the keys and values of the iterable it was constructed from > >

[PHP-DEV] Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-06-08 Thread tyson andre
Hi internals, > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > CachedIterable, > which eagerly evaluates any iterable and contains an immutable copy of the > keys and values of the iterable it was constructed from > > This has the proposed signature: > > ``` > final cl

Re: [PHP-DEV] Disable autovivification on false

2021-06-05 Thread tyson andre
Hi Kamil, > I have reworked the RFC based on some feedback. The improved RFC now will > hold 2 votes. One vote to decide whether the behaviour should be deprecated > from false, and another from null. > > If there are no objections then I would like to start the votes in a couple > of days. > >

[PHP-DEV] [VOTE] Straw poll: Namespace to use for CachedIterable and iterable functionality

2021-06-05 Thread tyson andre
Hi internals, Voting has started on https://wiki.php.net/rfc/cachediterable_straw_poll and ends in a week on June 12, 2021 (the voting period is shorter because this is a poll, not an RFC, and the feature freeze is soon) Previously, https://wiki.php.net/rfc/namespaces_in_bundled_extensions pass

[PHP-DEV] "Namespaces in bundled extensions" and iterable additions to the standard library

2021-06-01 Thread tyson andre
Hi internals, Recently, there have been 3 proposals to add functionality related to iterables/iterators to the standard library where voting was postponed for reasons related to namespacing policy: 1. https://wiki.php.net/rfc/any_all_on_iterable - where major objections were not having enough

[PHP-DEV] [VOTE] Allow static properties in enums

2021-06-01 Thread tyson andre
Hi internals, I have opened the vote on https://wiki.php.net/rfc/enum_allow_static_properties Voting ends on June 15, 2021 Previous discussion can be found at https://externals.io/message/114494 Thanks, Tyson -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://

[PHP-DEV] Re: [RFC]: Allow static properties in enums

2021-05-30 Thread tyson andre
Hi internals, > I've created a new RFC https://wiki.php.net/rfc/enum_allow_static_properties > > Although enums are immutable objects, it is often useful to have functions or > methods that operate on enum instances. > In many cases, it would make sense to declare that functionality as static >

Re: [PHP-DEV] [RFC]: Allow static properties in enums

2021-05-17 Thread tyson andre
> > On Mon, May 17, 2021, at 9:16 AM, Michał Marcin Brzuchalski wrote: > > > pon., 17 maj 2021, 16:02 użytkownik tyson andre < > > tysonandre...@hotmail.com> > > > napisał: > > > > > > > Hi internals, > > >

[PHP-DEV] [RFC]: Allow static properties in enums

2021-05-17 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/enum_allow_static_properties Although enums are immutable objects, it is often useful to have functions or methods that operate on enum instances. In many cases, it would make sense to declare that functionality as static methods on

Re: [PHP-DEV] [RFC] [Vote] Adding return types to internal methods

2021-04-24 Thread tyson andre
Hi Marco Pivetta, > > In fact, if reflection were to switch to the actual runtime return types of > > those methods, I don't see a reason why downstream consumers would break > > (stubbing tools, code generators, type checkers, dependency solvers, etc.) > > If the published library/application ha

Re: [PHP-DEV] [RFC] [Vote] Adding return types to internal methods

2021-04-24 Thread tyson andre
Hi Marco Pivetta, > In fact, if reflection were to switch to the actual runtime return types of > those methods, I don't see a reason why downstream consumers would break > (stubbing tools, code generators, type checkers, dependency solvers, etc.) If the published library/application had to suppo

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-04-05 Thread tyson andre
> > The question of namespaces in the stdlib has been coming up a lot recently, > > so I'd like to present my own stab at resolving this question: > > > > https://wiki.php.net/rfc/namespaces_in_bundled_extensions > > > > Relative to a number of previous (declined) proposals, the main difference > >

[PHP-DEV] Re: [RFC] debug_backtrace_depth(int $limit=0): int

2021-03-27 Thread tyson andre
Hi internals, > I've created a new RFC https://wiki.php.net/rfc/debug_backtrace_depth to > return the depth of the current stack trace. > > Inspecting the current stack trace depth is occasionally useful for > 1. Manually debugging with temporary debug statements > 2. Checking for potential infi

Re: [PHP-DEV] [RFC] Namespaced in bundled extensions

2021-03-19 Thread tyson andre
Hi Nikita Popov, > The question of namespaces in the stdlib has been coming up a lot recently, > so I'd like to present my own stab at resolving this question: > > https://wiki.php.net/rfc/namespaces_in_bundled_extensions > > Relative to a number of previous (declined) proposals, the main differen

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-14 Thread tyson andre
Hi Rowan, > Hi Tyson, > > I'm on the fence on this one: I've certainly had occasions when it would > be useful, but mostly in quick prototypes and demo code, and just as > often in HTML context (where I'd want it to add '') as plain text > context. > > I am not keen, however, on the proposed

Re: [PHP-DEV] Storing the lcname of symbols

2021-03-13 Thread tyson andre
Hi Levi Morrison, > > Hello! > > > > Most of PHP's symbols are case insensitive. This means extensions that > > need to do things with function and method names end up lowercasing > > and hashing the lowercased names, often having to do more memory > > allocations too. Since case insensitive symbo

Re: [PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-13 Thread tyson andre
> Hi Tyson, > > I like this proposal, but why is the main argument optional? Wouldn't it > make sense to always require a string as an argument? > > Regards, > Kamil I initially considered making it required, but then I felt like there wasn't a compelling reason to force end users to write `pri

[PHP-DEV] RFC: Add `println(string $data = ''): int`

2021-03-13 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/println This proposes adding a global function to PHP to print a string followed by a unix newline (`\n`). Printing a string followed by a newline to stdout is a commonly performed operation in many applications and programming langu

[PHP-DEV] [RFC] debug_backtrace_depth(int $limit=0): int

2021-03-13 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/debug_backtrace_depth to return the depth of the current stack trace. Inspecting the current stack trace depth is occasionally useful for 1. Manually debugging with temporary debug statements 2. Checking for potential infinite recursi

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread tyson andre
Hi Rowan Tommins, > I would like to propose we formally deprecate the function debug_zval_dump > and remove it in PHP 9.0. > > This function is mostly similar to var_dump, with the additional ability to > output the refcount of a variable. This has always been hard to interpret, > but is now s

Re: [PHP-DEV] Re: Proposal: namespace the SPL

2021-02-14 Thread tyson andre
; I will be proposing new types for ext/spl soon (ReverseIterator > > and an array iterator that is more efficient than \ArrayIterator), > > and Tyson Andre has already proposed CachedIterable and company > > which is in ext/spl, so this space has active development. > > Thank yo

Re: [PHP-DEV] RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-02-12 Thread tyson andre
Hi Alex, > > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > > CachedIterable, > > which eagerly evaluates any iterable and contains an immutable copy of the > > keys and values of the iterable it was constructed from > > > > > > Any other feedback unrelated to namespaces

[PHP-DEV] Re: RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-02-11 Thread tyson andre
Hi internals, > I've created a new RFC https://wiki.php.net/rfc/cachediterable adding > CachedIterable, > which eagerly evaluates any iterable and contains an immutable copy of the > keys and values of the iterable it was constructed from > > This has the proposed signature: > > ``` > final cl

[PHP-DEV] RFC: CachedIterable (rewindable, allows any key&repeating keys)

2021-02-10 Thread tyson andre
Hi internals, I've created a new RFC https://wiki.php.net/rfc/cachediterable adding CachedIterable, which eagerly evaluates any iterable and contains an immutable copy of the keys and values of the iterable it was constructed from This has the proposed signature: ``` final class CachedIterable

Re: [PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-10 Thread tyson andre
hing. - This is different in that there's only 2 desired values. https://wiki.php.net/rfc/stable_sorting fixed that calling it twice and deprecating booleans. It still allows you to return strings (not likely in practice) and casts those to integers. "Second, if boolean false is returned, PHP will automatically call the comparison function again with arguments swapped. This allows us to distinguish whether the “false” stood for “equal” or “smaller than”. This fallback behavior should be removed in a future version of PHP." > Anyway, to me it feels natural that any()/all() would "work" like > array_filter(). > > @Tyson by the way, in the any()/all() case (vs the any_value()/all_values() > and potential any_key()/all_keys() etc.), wouldn't it be preferable to add > the optional `int $flags = 0` (or "$mode") parameter right from the start > (even if not used yet), as adding it in a later release would apparently pose > some BC concerns (ArgumentCountError, polyfills etc.)? If an iterables RFC passed, and all amendments got approved before 8.1 stable was released, it wouldn't matter. There's months before the feature freeze. If a function was added with flags "just in case" in 8.1 stable and we never used the flags, we'd have to deprecate them and remove them in a subsequent major release. I don't think that's worth it. Cheers, Tyson Andre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-08 Thread tyson andre
Hi Larry Garfield, > > Hi Larry Garfield, > > > > > > Hi internals, > > > > > > > > Voting has started on https://wiki.php.net/rfc/any_all_on_iterable and > > > > ends on 2021-02-22. > > > > > > > > This RFC proposes to add the functions `PHP\iterable\any(iterable > > > > $input, ?callable $c

[PHP-DEV] Re: [VOTE] PHP\iterable\any() and all() on iterables

2021-02-08 Thread tyson andre
Hi internals, > Voting has started on https://wiki.php.net/rfc/any_all_on_iterable and ends > on 2021-02-22. > > This RFC proposes to add the functions `PHP\iterable\any(iterable $input, > ?callable $callback = null): bool` and `PHP\iterable\all(...)` > to PHP's standard library's function set,

Re: [PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-08 Thread tyson andre
Hi Levi Morrison, > > Hi internals, > > > > Voting has started on https://wiki.php.net/rfc/any_all_on_iterable and ends > > on 2021-02-22. > > > > This RFC proposes to add the functions `PHP\iterable\any(iterable $input, > > ?callable $callback = null): bool` and `PHP\iterable\all(...)` > > to P

Re: [PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-08 Thread tyson andre
Hi Larry Garfield, > > Hi internals, > > > > Voting has started on https://wiki.php.net/rfc/any_all_on_iterable and > > ends on 2021-02-22. > > > > This RFC proposes to add the functions `PHP\iterable\any(iterable > > $input, ?callable $callback = null): bool` and `PHP\iterable\all(...)` > > t

[PHP-DEV] [VOTE] PHP\iterable\any() and all() on iterables

2021-02-08 Thread tyson andre
Hi internals, Voting has started on https://wiki.php.net/rfc/any_all_on_iterable and ends on 2021-02-22. This RFC proposes to add the functions `PHP\iterable\any(iterable $input, ?callable $callback = null): bool` and `PHP\iterable\all(...)` to PHP's standard library's function set, using the n

[PHP-DEV] Re: [RFC] Global functions any() and all() on iterables

2021-02-06 Thread tyson andre
Hi internals, > I've created an RFC for https://wiki.php.net/rfc/any_all_on_iterable > > This was proposed 2 days ago in https://externals.io/message/111711 with some > interest > ("Proposal: Adding functions any(iterable $input, ?callable $cb = null, int > $use_flags=0) and all(...)") > > - Th

[PHP-DEV] [VOTE] var_representation() : readable alternative to var_export()

2021-02-05 Thread tyson andre
Hi internals, Voting has started today on https://wiki.php.net/rfc/readable_var_representation and closes on 2021-02-19. This RFC proposes introducing a new function `var_representation` with the following differences from var_export: 1. `var_representation()` unconditionally returns a string 2.

Re: [PHP-DEV] Re: [RFC] var_representation() : readable alternative to var_export()

2021-02-04 Thread tyson andre
Hi internals, > > > I've created https://wiki.php.net/rfc/readable_var_representation based on > > > my original proposal in https://externals.io/message/112924 > > > > > > This RFC proposes adding a new function `var_representation(mixed $value, > > > int $flags=0): string` > > > with the follo

Re: [PHP-DEV] Re: [RFC] var_representation() : readable alternative to var_export()

2021-02-04 Thread tyson andre
Hi internals, > > > I've created https://wiki.php.net/rfc/readable_var_representation based on > > > my original proposal in https://externals.io/message/112924 > > > > > > [...] > > > > A reminder that voting on the var_representation RFC starts in a day. > > This RFC proposes adding a new func

  1   2   3   4   >