Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Sun, Feb 14, 2021 at 5:51 PM Levi Morrison wrote: > > Oof, this is a long one. I'm going to snip some of it but respond to > most things privately; I will also respond to some things publicly > later. > > On Sun, Feb 14, 2021 at 3:44 PM tyson andre wrote: > > > > Hi internals, > > > > > > 1b. We may switch the direction of this alias in 9.0. > > > > The new names for existing Spl types at least seem more readable and > > possible to polyfill with `class_alias`. > > It should be clarified if "data types" include interfaces such as > > https://www.php.net/manual/en/class.splobserver > > but I assume it does. > > > > > Do you have an expected timeline for creating the RFC document for this > > proposal and starting the vote? > > A vote would greatly reduce the uncertainty and time/energy involvement of > > proposing > > adding additional datastructures, benefiting contributors both familiar and > > unfamiliar > > with the PHP RFC process, and I agree with Levi that it would be useful to > > ensure that > > "new additions going into the ext/spl can avoid having this naming > > discussion every time." > > I will write a formal RFC this week, and it will include all of the > proposed aliases (unless the sentiment is that we don't want them; I > talk about this a bit more later in this email). > > > **My main objection to the proposal is that this forces > > all core generic datastructures to go in the Spl namespace > > indefinitely, or would entail the creation of a separate module and > > splitting up the php.net manual pages to document new built-in > > datastructures > > that don't begin with `SPL\`.** > > This is a logical conclusion from how it was worded, but it's not what > I meant. I meant to say that ext/spl is open for contributions in > certain spaces: > 1. Generic data structures and their iterators. (not highly specific > ones, like a hypothetical LaravelEventQueue). > 2. Generic iterators. > 3. File oriented types (I omitted this originally, but it was unintentional) > > Anyone can propose new additions to ext/spl and if they are in that > scope (and maybe a few more like exceptions, we'll see), but they > aren't forced to go into the SPL. It probably makes sense to add it to > the SPL, but if there was a large proposal, like an iterable oriented > library with over a dozen symbols, then I'm sure a case can be made > for putting it somewhere else too. > > > If we were to enforce that all new datastructures introduced > > into SPL started with `SPL` I'd have to consider moving the > > `CachedIterable` proposal to `ext/std` or a > > new always-enabled module such as `std_ds` for classes introduced in PHP 8, > > but if it turns out there's widespread support for the namespace choicing > > of `Spl\...ForwardArrayIterator` > > I would very likely go with `Spl\...CachedIterable`. > > > > - I'd proposed `CachedIterable`, not `SplCachedIterable`. > > - It'd force a choice between inconsistencies. > > In my opinion, we shouldn't be adding very many symbols to the global > namespace that are unprefixed. Things should be namespaced either by > using a real namespace (preferred) or by a prefix. That isn't to say I > would outright ban it -- there could be perhaps new core interfaces > that may make sense to go there if they interact with the language in > special ways. Or at least, they belong in the global namespace by > status quo until we can agree on an official namespace policy for > such. > > > I would find it inconsistent to use the Spl naming scheme both for > > classes with extremely old design decisions > > from php 5.3 > > This does not bother me, but I would also be open to not aliasing > existing types if that would make people happier. If we don't alias > the existing types, then there will be a small `Spl` namespace with > only newer additions (which are probably of higher overall quality > than the prefixed versions). I am okay with this, but sometimes people > feel like this kind of thing is too small in scope. > > > It'd also be inconsistent to have two different sections in the PHP > > manual for datastructures because of a constraint on the folder `ext/spl`. > > I guess phasing out `SplStack` and so on to switch to recommending brand > > new redesigned datastructures such as `PHP\std\Vector` or `PHP\ds\Vector` > > would be another option. > > - Right now, SPL is a mix of classes/interfaces/functions prefixed with Spl > > and those that aren't, > > if you look at https://www.php.net/manual/en/book.spl.php , > > SPL already has data structures such as `ArrayObject` and interfaces that > > aren't prefixed. > > Yes, the SPL is not fully consistent. Some of these things have moved > out of the SPL over time (such as the Countable interface). Most data > structures are prefixed, but no iterators are. In other words, it has > some warts but at least mostly has a pattern going. As mentioned > earlier, I think nearly all new symbols need to be namespaced or
Re: [PHP-DEV] Re: Proposal: namespace the SPL
Oof, this is a long one. I'm going to snip some of it but respond to most things privately; I will also respond to some things publicly later. On Sun, Feb 14, 2021 at 3:44 PM tyson andre wrote: > > Hi internals, > > > > 1b. We may switch the direction of this alias in 9.0. > > The new names for existing Spl types at least seem more readable and possible > to polyfill with `class_alias`. > It should be clarified if "data types" include interfaces such as > https://www.php.net/manual/en/class.splobserver > but I assume it does. > Do you have an expected timeline for creating the RFC document for this > proposal and starting the vote? > A vote would greatly reduce the uncertainty and time/energy involvement of > proposing > adding additional datastructures, benefiting contributors both familiar and > unfamiliar > with the PHP RFC process, and I agree with Levi that it would be useful to > ensure that > "new additions going into the ext/spl can avoid having this naming discussion > every time." I will write a formal RFC this week, and it will include all of the proposed aliases (unless the sentiment is that we don't want them; I talk about this a bit more later in this email). > **My main objection to the proposal is that this forces > all core generic datastructures to go in the Spl namespace > indefinitely, or would entail the creation of a separate module and splitting > up the php.net manual pages to document new built-in datastructures > that don't begin with `SPL\`.** This is a logical conclusion from how it was worded, but it's not what I meant. I meant to say that ext/spl is open for contributions in certain spaces: 1. Generic data structures and their iterators. (not highly specific ones, like a hypothetical LaravelEventQueue). 2. Generic iterators. 3. File oriented types (I omitted this originally, but it was unintentional) Anyone can propose new additions to ext/spl and if they are in that scope (and maybe a few more like exceptions, we'll see), but they aren't forced to go into the SPL. It probably makes sense to add it to the SPL, but if there was a large proposal, like an iterable oriented library with over a dozen symbols, then I'm sure a case can be made for putting it somewhere else too. > If we were to enforce that all new datastructures introduced > into SPL started with `SPL` I'd have to consider moving the `CachedIterable` > proposal to `ext/std` or a > new always-enabled module such as `std_ds` for classes introduced in PHP 8, > but if it turns out there's widespread support for the namespace choicing of > `Spl\...ForwardArrayIterator` > I would very likely go with `Spl\...CachedIterable`. > > - I'd proposed `CachedIterable`, not `SplCachedIterable`. > - It'd force a choice between inconsistencies. In my opinion, we shouldn't be adding very many symbols to the global namespace that are unprefixed. Things should be namespaced either by using a real namespace (preferred) or by a prefix. That isn't to say I would outright ban it -- there could be perhaps new core interfaces that may make sense to go there if they interact with the language in special ways. Or at least, they belong in the global namespace by status quo until we can agree on an official namespace policy for such. > I would find it inconsistent to use the Spl naming scheme both for classes > with extremely old design decisions > from php 5.3 This does not bother me, but I would also be open to not aliasing existing types if that would make people happier. If we don't alias the existing types, then there will be a small `Spl` namespace with only newer additions (which are probably of higher overall quality than the prefixed versions). I am okay with this, but sometimes people feel like this kind of thing is too small in scope. > It'd also be inconsistent to have two different sections in the PHP manual > for datastructures because of a constraint on the folder `ext/spl`. > I guess phasing out `SplStack` and so on to switch to recommending brand > new redesigned datastructures such as `PHP\std\Vector` or `PHP\ds\Vector` > would be another option. > - Right now, SPL is a mix of classes/interfaces/functions prefixed with Spl > and those that aren't, > if you look at https://www.php.net/manual/en/book.spl.php , > SPL already has data structures such as `ArrayObject` and interfaces that > aren't prefixed. Yes, the SPL is not fully consistent. Some of these things have moved out of the SPL over time (such as the Countable interface). Most data structures are prefixed, but no iterators are. In other words, it has some warts but at least mostly has a pattern going. As mentioned earlier, I think nearly all new symbols need to be namespaced or prefixed, so I think it's worth breaking the no-prefix, no-namespace tradition of the iterators for new iterator types (at least concrete ones; there may be room for new interfaces in the core language). -- PHP Internals - PHP Runtime Development
Re: [PHP-DEV] Re: Proposal: namespace the SPL
Hi internals, > > 1b. We may switch the direction of this alias in 9.0. The new names for existing Spl types at least seem more readable and possible to polyfill with `class_alias`. It should be clarified if "data types" include interfaces such as https://www.php.net/manual/en/class.splobserver but I assume it does. A minor concern is that the wider switch on a case-by-case basis to namespacing will collectively add a lot of small barriers for end users that are upgrading (especially with external libraries/applications), but agree that starting out small is the best way to discuss it. - e.g. data `serialize()`d and put into memcached or a database by PHP 9.0 could not be read from memcached by servers still running PHP 8.0, and this would unexpectedly result in PHP_Incomplete_Class and new users may need to do a lot of research to figure out how to avoid/fix this (by calling `class_alias` in 8.0). > > Let me know what you think. I am hopeful this approach will work because: I support voting on this separately from adding new functionality. To clarify my earlier decisions, I had strong reservations about introducing new functionality and setting a de facto precedent for a namespace policy in the same vote on https://wiki.php.net/rfc/any_all_on_iterable (but did so anyway due to feedback of multiple voters suggesting widespread opposition to continuing global namespacing months ago), because the deciding factor in a vote on new functions or new classes for voters may have been "do I (dislike the namespacing choice used in this RFC) less than (I dislike not having this useful proposed enhancement added to PHP)." and am happier with your plan to create an RFC asking "do 2/3rds of people think this namespace choice should be used for future additions to ext/spl." In my decision to independently gather feedback for https://wiki.php.net/rfc/any_all_on_iterable_straw_poll_namespace I was deliberately overcommunicating knowing that: 1. If it passed, the namespacing policy choices made there might be interpreted or insisted on as a precedent for future additions to the Spl (or even PHP in general) for a long time. This may cause a tolerable namespace choice to be used for many future additions to ext/spl, rather than the one preferred by most of internals, which is why I was only fine with starting a vote after gathering feedback from https://wiki.php.net/rfc/any_all_on_iterable_straw_poll_namespace 2. If it was voted on without gathering widespread feedback on overall namespace preferences, I'd expect even more No votes and the function namespacing discussion could continually get reopened if some namespace permutation wasn't even an option. I apologize for the 11-way straw poll. Many voters do not comment on the internals mailing list, e.g. if someone else has already said the same thing. > > Let me know what you think. I am hopeful this approach will work because: > > > > It is focused on a specific area which already has an established > > "namespace", but in name-only (not technically). > > It does not try to solve the larger problem, which has a lot of > > disagreement. > > 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 you for your time. > > Do you want a dumping ground? Because this is how you create a dumping > ground :-) > > If we're going to start putting things into namespaces (and we should) > then we should absolutely avoid repeating the mistakes of the past by > dumping completely unrelated things together. > > If SPL\ is to exist (and personally I think SPL is so cancerous, it > shouldn't) then IMO it must absolutely be SPL\iterators. > > Without that all we've done is swap one problem for another. > > The idea of putting data structures next to generic iterator helpers is, > quite frankly, nuts. Do you have an expected timeline for creating the RFC document for this proposal and starting the vote? A vote would greatly reduce the uncertainty and time/energy involvement of proposing adding additional datastructures, benefiting contributors both familiar and unfamiliar with the PHP RFC process, and I agree with Levi that it would be useful to ensure that "new additions going into the ext/spl can avoid having this naming discussion every time." **My main objection to the proposal is that this forces all core generic datastructures to go in the Spl namespace indefinitely, or would entail the creation of a separate module and splitting up the php.net manual pages to document new built-in datastructures that don't begin with `SPL\`.** Right now, the collection of classes in SPL is fairly small - it's used in library code but rarely used directly, but if PHP were to add a collection of datastructures
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Sat, Feb 13, 2021 at 10:57 AM Pierre R. wrote: > > Le 13/02/2021 à 18:01, Levi Morrison via internals a écrit : > > You make some good points, Pierre. Here are my main rebuttals: > > > > 1. "Spl" is already the effective namespace for the SPL because > > that's the prefix used by SplFixedArray, SplQueue, spl_classes, and so > > on. Its namespace has already been de facto chosen. > > > > 2. We have two proposals adding new things to the SPL for 8.1, so we > > need to decide if they are going into ext/spl as 1. \Spl\Thing, 2. > > \SplThing, or 3. \Thing. Keeping the wider vision in mind is a great > > principle, but we need to decide on these new additions _now_ despite > > not reaching consensus on the wider thing. > > > > Obviously, I'm hopeful we can agree on using the Spl namespace for > > these additions, and any future SPL additions. > > > >[1]: https://wiki.php.net/rfc/any_all_on_iterable#vote > > Aside of the fact I don't like "Spl" if a good naming convention comes > out with it prefixing all namespaces so be it and I'll be happy. One > thing that bother me much in the current proposal is those kind of > classes: `Spl\FixedArray -> SplFixedArray`. > > That's the most important point in my eyes, it should be already named > with a deeper namespace, such as: > > `Spl\[Collection|List]\{FixedArray,Vector,Queue,LinkedList,...}` > > in order to make space for later other namespaces to take their rightful > place, such as: > > `Spl\Security\{PasswordHash,RandomNumberGenerator,...}` or > > `Spl\[Io|File|FileSystem]\{FileBuffer,DirectoryIterator}`. > > Even if it starts with a narrow scope, it *must*, in my opinion, make > space for later additions, therefore `Spl\` must be considered as being > the "PHP standard library root namespace", in that regard, no classes or > functions must live at root, they must be segregated in their own > sub-namespace. If we don't do this, we will very much regret it later. > > Regards, > > -- > > Pierre > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > To be clear, I am arguing that `Spl` be the namespace for future additions to `ext/spl`, and that we alias a few existing types for consistency. Just as `ext/spl` is not the whole PHP standard library (just one small part of it), the `Spl` namespace I am proposing is not the "PHP standard library root namespace" either; it's just the namespace for the bits in `ext/spl`. What you are arguing for was the subject of recent namespacing proposals, which failed to reach consensus. I am intentionally proposing a different solution for a much narrower problem hoping it will stick, so that new additions going into the ext/spl can avoid having this naming discussion every time. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Re: Proposal: namespace the SPL
Le 13/02/2021 à 18:01, Levi Morrison via internals a écrit : You make some good points, Pierre. Here are my main rebuttals: 1. "Spl" is already the effective namespace for the SPL because that's the prefix used by SplFixedArray, SplQueue, spl_classes, and so on. Its namespace has already been de facto chosen. 2. We have two proposals adding new things to the SPL for 8.1, so we need to decide if they are going into ext/spl as 1. \Spl\Thing, 2. \SplThing, or 3. \Thing. Keeping the wider vision in mind is a great principle, but we need to decide on these new additions _now_ despite not reaching consensus on the wider thing. Obviously, I'm hopeful we can agree on using the Spl namespace for these additions, and any future SPL additions. [1]: https://wiki.php.net/rfc/any_all_on_iterable#vote Aside of the fact I don't like "Spl" if a good naming convention comes out with it prefixing all namespaces so be it and I'll be happy. One thing that bother me much in the current proposal is those kind of classes: `Spl\FixedArray -> SplFixedArray`. That's the most important point in my eyes, it should be already named with a deeper namespace, such as: `Spl\[Collection|List]\{FixedArray,Vector,Queue,LinkedList,...}` in order to make space for later other namespaces to take their rightful place, such as: `Spl\Security\{PasswordHash,RandomNumberGenerator,...}` or `Spl\[Io|File|FileSystem]\{FileBuffer,DirectoryIterator}`. Even if it starts with a narrow scope, it *must*, in my opinion, make space for later additions, therefore `Spl\` must be considered as being the "PHP standard library root namespace", in that regard, no classes or functions must live at root, they must be segregated in their own sub-namespace. If we don't do this, we will very much regret it later. Regards, -- Pierre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Sat, Feb 13, 2021 at 9:25 AM Pierre wrote: > > Le 11/02/2021 à 18:48, Chase Peeler a écrit : > > I think Spl makes sense (there might be a debate over whether it should be > > Spl or SPL though). How feasible is it to create generate a deprecation > > notice when the global version is used? I assume the hope is to eventually > > move away from using those, and I don't think that's a horrible BC break > > given that users have enough time to prepare for it. > > Hello, > > For what it worth, I think that Spl is both ugly to read (yes, I like > things not only to be semantic, but elegant as well) and hard to type on > my keyboard (OK subjective point here, both are actually). > > "Spl" does mean somethings, but I'd prefer something more generic such > as "std" or "standard" or "system", or even "stdlib". And it's an > opinion, and we all have one. Even having lowercased namespace names for > PHP standard library wouldn't bother me much: it would make it > consistent in reading (e.g. `use std\array\first` for example, vs > \array_first()` vs `use Spl\Array\first`). OK stupid point here, but > fact is I don't really care, I just try to make a point here: we are > free to invent new things, or get old things from other languages. We > have all the possibilities of the world and beyond offering themselves > to us, the only limit is our imagination. > > I disagree about narrow scope: if we / you don't think about the future, > each narrow iteration will only get more and more inconsistent, each > step will be a flame ware about naming, and no convention or consistency > will emerge. And it will be slow. I will retire before I'll see an Array > class or a `collection` namespace. And I'm not even that old! This will > fatigue people, and kill any kind of good faith or good sense we still > yet have. > > I think that namespacing, even if its implementation starts narrow (this > make sense) should be thought thoroughly with a wider scope, with a > global scheme even more. It should be voted with a complete view of what > it will become, and how that makes stuff consistent across the whole > actual and future SPL. > > I know this has not much chances to happen, because people always > disagree for purely subjective reasons (beauty of names, ease of typing, > semantic meaning of stuff, weird keyboard layout, or just because some > people don't like when it's other people's ideas which get to be chosen > or voted for) anyhow, I think that narrow scope will only gets PHP > standard library farther from its goal than help it. > > This was my 2 cents, > > Best regards, > > -- > > Pierre > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > You make some good points, Pierre. Here are my main rebuttals: 1. "Spl" is already the effective namespace for the SPL because that's the prefix used by SplFixedArray, SplQueue, spl_classes, and so on. Its namespace has already been de facto chosen. 2. We have two proposals adding new things to the SPL for 8.1, so we need to decide if they are going into ext/spl as 1. \Spl\Thing, 2. \SplThing, or 3. \Thing. Keeping the wider vision in mind is a great principle, but we need to decide on these new additions _now_ despite not reaching consensus on the wider thing. Obviously, I'm hopeful we can agree on using the Spl namespace for these additions, and any future SPL additions. [1]: https://wiki.php.net/rfc/any_all_on_iterable#vote -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Re: Proposal: namespace the SPL
Le 11/02/2021 à 18:48, Chase Peeler a écrit : I think Spl makes sense (there might be a debate over whether it should be Spl or SPL though). How feasible is it to create generate a deprecation notice when the global version is used? I assume the hope is to eventually move away from using those, and I don't think that's a horrible BC break given that users have enough time to prepare for it. Hello, For what it worth, I think that Spl is both ugly to read (yes, I like things not only to be semantic, but elegant as well) and hard to type on my keyboard (OK subjective point here, both are actually). "Spl" does mean somethings, but I'd prefer something more generic such as "std" or "standard" or "system", or even "stdlib". And it's an opinion, and we all have one. Even having lowercased namespace names for PHP standard library wouldn't bother me much: it would make it consistent in reading (e.g. `use std\array\first` for example, vs \array_first()` vs `use Spl\Array\first`). OK stupid point here, but fact is I don't really care, I just try to make a point here: we are free to invent new things, or get old things from other languages. We have all the possibilities of the world and beyond offering themselves to us, the only limit is our imagination. I disagree about narrow scope: if we / you don't think about the future, each narrow iteration will only get more and more inconsistent, each step will be a flame ware about naming, and no convention or consistency will emerge. And it will be slow. I will retire before I'll see an Array class or a `collection` namespace. And I'm not even that old! This will fatigue people, and kill any kind of good faith or good sense we still yet have. I think that namespacing, even if its implementation starts narrow (this make sense) should be thought thoroughly with a wider scope, with a global scheme even more. It should be voted with a complete view of what it will become, and how that makes stuff consistent across the whole actual and future SPL. I know this has not much chances to happen, because people always disagree for purely subjective reasons (beauty of names, ease of typing, semantic meaning of stuff, weird keyboard layout, or just because some people don't like when it's other people's ideas which get to be chosen or voted for) anyhow, I think that narrow scope will only gets PHP standard library farther from its goal than help it. This was my 2 cents, Best regards, -- Pierre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Thu, Feb 11, 2021 at 1:08 PM Lynn wrote: > > > On Thu, Feb 11, 2021 at 6:55 PM Levi Morrison via internals < > internals@lists.php.net> wrote: > >> I don't know the answer to that question. However, I don't think we >> should add a deprecation on the very first version that we add the >> aliases anyway. I think that would make for a bad upgrade experience >> from 8.0 to 8.1. I would leave that more for 8.3, 8.4-ish in the >> release cycle so there are at least a few versions for people to >> organically change their code without triggering any notices of any >> kind. >> > > I would very much prefer this to be deprecated in the same version. This > way you prevent the confusion of which of the two to use and have people > implement the one we already know is going to be removed. Deprecations do > not make it a bad upgrade experience at all. Quite the opposite in my > opinion, they hint to me nice and early on which parts of the code base I > have to adjust. The earlier the better. > I'm really ambivalent about when they are introduced, but I actually think I agree with you. I know it's very much just a personal anecdote, but since I don't turn deprecation notices on until I'm ready to actually look for and fix them, I don't find them obtrusive at all. -- Chase Peeler chasepee...@gmail.com
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Thu, Feb 11, 2021 at 6:55 PM Levi Morrison via internals < internals@lists.php.net> wrote: > I don't know the answer to that question. However, I don't think we > should add a deprecation on the very first version that we add the > aliases anyway. I think that would make for a bad upgrade experience > from 8.0 to 8.1. I would leave that more for 8.3, 8.4-ish in the > release cycle so there are at least a few versions for people to > organically change their code without triggering any notices of any > kind. > I would very much prefer this to be deprecated in the same version. This way you prevent the confusion of which of the two to use and have people implement the one we already know is going to be removed. Deprecations do not make it a bad upgrade experience at all. Quite the opposite in my opinion, they hint to me nice and early on which parts of the code base I have to adjust. The earlier the better.
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Thu, Feb 11, 2021 at 10:48 AM Chase Peeler wrote: > > > > On Thu, Feb 11, 2021 at 12:23 PM Levi Morrison via internals > wrote: >> >> On Thu, Feb 11, 2021 at 9:57 AM Mark Randall wrote: >> > >> > On 11/02/2021 16:39, Levi Morrison wrote: >> > > Let me know what you think. I am hopeful this approach will work because: >> > > 1. It is focused on a specific area which already has an established >> > > "namespace", but in name-only (not technically). >> > > 2. It does not try to solve the larger problem, which has a lot of >> > > disagreement. >> > > 3. 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 you for your time. >> > > >> > >> > Do you want a dumping ground? Because this is how you create a dumping >> > ground :-) >> > >> > If we're going to start putting things into namespaces (and we should) >> > then we should absolutely avoid repeating the mistakes of the past by >> > dumping completely unrelated things together. >> >> I agree, which is the point of accepting things in a narrow scope. >> Data structures and iterators go hand-in-hand, as many iterator >> implementations are directly connected to the internal implementation >> details of the related data structure. There are other iterators, and >> as long as they are general purpose they are fine too. These things >> are related, not unrelated. >> >> > If SPL\ is to exist (and personally I think SPL is so cancerous, it >> > shouldn't) then IMO it must absolutely be SPL\iterators. >> >> As mentioned in the previous point, iterators and data structures >> belong together. It does not make sense to separate the implementation >> of FixedArray and its iterator into two different namespaces; they are >> one cohesive unit. >> >> Lastly, if we don't adopt a namespace soon, what will new names be? I >> can guarantee it will be something like `SplReverseIterator`, not >> `SplIteratorReverseIterator`. It won't be >> `SplDatastructureCachedIterable`, it would be something like >> `SplCachedIterable` (or `CachedIterable`, ugh). >> >> As you see, "Spl" _is_ the namespace. Any more or any less is >> incongruent with what we have. This is why I am hopeful that >> _specifically_ using "Spl" for these specific types can reach >> agreement; all we are changing is `Spl$thing` to `Spl\$thing`. >> > > I think Spl makes sense (there might be a debate over whether it should be > Spl or SPL though). How feasible is it to create generate a deprecation > notice when the global version is used? I assume the hope is to eventually > move away from using those, and I don't think that's a horrible BC break > given that users have enough time to prepare for it. I don't know the answer to that question. However, I don't think we should add a deprecation on the very first version that we add the aliases anyway. I think that would make for a bad upgrade experience from 8.0 to 8.1. I would leave that more for 8.3, 8.4-ish in the release cycle so there are at least a few versions for people to organically change their code without triggering any notices of any kind. >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: https://www.php.net/unsub.php >> > > > -- > Chase Peeler > chasepee...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Thu, Feb 11, 2021 at 12:23 PM Levi Morrison via internals < internals@lists.php.net> wrote: > On Thu, Feb 11, 2021 at 9:57 AM Mark Randall wrote: > > > > On 11/02/2021 16:39, Levi Morrison wrote: > > > Let me know what you think. I am hopeful this approach will work > because: > > > 1. It is focused on a specific area which already has an established > > > "namespace", but in name-only (not technically). > > > 2. It does not try to solve the larger problem, which has a lot of > > > disagreement. > > > 3. 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 you for your time. > > > > > > > Do you want a dumping ground? Because this is how you create a dumping > > ground :-) > > > > If we're going to start putting things into namespaces (and we should) > > then we should absolutely avoid repeating the mistakes of the past by > > dumping completely unrelated things together. > > I agree, which is the point of accepting things in a narrow scope. > Data structures and iterators go hand-in-hand, as many iterator > implementations are directly connected to the internal implementation > details of the related data structure. There are other iterators, and > as long as they are general purpose they are fine too. These things > are related, not unrelated. > > > If SPL\ is to exist (and personally I think SPL is so cancerous, it > > shouldn't) then IMO it must absolutely be SPL\iterators. > > As mentioned in the previous point, iterators and data structures > belong together. It does not make sense to separate the implementation > of FixedArray and its iterator into two different namespaces; they are > one cohesive unit. > > Lastly, if we don't adopt a namespace soon, what will new names be? I > can guarantee it will be something like `SplReverseIterator`, not > `SplIteratorReverseIterator`. It won't be > `SplDatastructureCachedIterable`, it would be something like > `SplCachedIterable` (or `CachedIterable`, ugh). > > As you see, "Spl" _is_ the namespace. Any more or any less is > incongruent with what we have. This is why I am hopeful that > _specifically_ using "Spl" for these specific types can reach > agreement; all we are changing is `Spl$thing` to `Spl\$thing`. > > I think Spl makes sense (there might be a debate over whether it should be Spl or SPL though). How feasible is it to create generate a deprecation notice when the global version is used? I assume the hope is to eventually move away from using those, and I don't think that's a horrible BC break given that users have enough time to prepare for it. > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > -- Chase Peeler chasepee...@gmail.com
Re: [PHP-DEV] Re: Proposal: namespace the SPL
On Thu, Feb 11, 2021 at 9:57 AM Mark Randall wrote: > > On 11/02/2021 16:39, Levi Morrison wrote: > > Let me know what you think. I am hopeful this approach will work because: > > 1. It is focused on a specific area which already has an established > > "namespace", but in name-only (not technically). > > 2. It does not try to solve the larger problem, which has a lot of > > disagreement. > > 3. 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 you for your time. > > > > Do you want a dumping ground? Because this is how you create a dumping > ground :-) > > If we're going to start putting things into namespaces (and we should) > then we should absolutely avoid repeating the mistakes of the past by > dumping completely unrelated things together. I agree, which is the point of accepting things in a narrow scope. Data structures and iterators go hand-in-hand, as many iterator implementations are directly connected to the internal implementation details of the related data structure. There are other iterators, and as long as they are general purpose they are fine too. These things are related, not unrelated. > If SPL\ is to exist (and personally I think SPL is so cancerous, it > shouldn't) then IMO it must absolutely be SPL\iterators. As mentioned in the previous point, iterators and data structures belong together. It does not make sense to separate the implementation of FixedArray and its iterator into two different namespaces; they are one cohesive unit. Lastly, if we don't adopt a namespace soon, what will new names be? I can guarantee it will be something like `SplReverseIterator`, not `SplIteratorReverseIterator`. It won't be `SplDatastructureCachedIterable`, it would be something like `SplCachedIterable` (or `CachedIterable`, ugh). As you see, "Spl" _is_ the namespace. Any more or any less is incongruent with what we have. This is why I am hopeful that _specifically_ using "Spl" for these specific types can reach agreement; all we are changing is `Spl$thing` to `Spl\$thing`. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php
[PHP-DEV] Re: Proposal: namespace the SPL
On 11/02/2021 16:39, Levi Morrison wrote: Let me know what you think. I am hopeful this approach will work because: 1. It is focused on a specific area which already has an established "namespace", but in name-only (not technically). 2. It does not try to solve the larger problem, which has a lot of disagreement. 3. 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 you for your time. Do you want a dumping ground? Because this is how you create a dumping ground :-) If we're going to start putting things into namespaces (and we should) then we should absolutely avoid repeating the mistakes of the past by dumping completely unrelated things together. If SPL\ is to exist (and personally I think SPL is so cancerous, it shouldn't) then IMO it must absolutely be SPL\iterators. Without that all we've done is swap one problem for another. The idea of putting data structures next to generic iterator helpers is, quite frankly, nuts. Mark Randall -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php