Hello, everyone,
There has been a lot of disagreement about namespacing, and people
seem to have different viewpoints. I am not sure how to reconcile this
broader discussion.
However, there are certain names in the global namespace which I am
hopeful we can revolve. For instance, SplObserver
, SplQueue
,
SplFixedArray
, etc all follow the Spl
prefix. There is already an
established "namespace" for these names.
So here is my limited proposal:
- We create names in the
Spl
namespace that are aliases to their
equivalent types with theSpl
prefix:
Spl\FixedArray
-> SplFixedArray
Spl\Queue
-> SplQueue
a. The new names are the aliases so any code which uses
get_class($obj)
will not have the name change on them in a minor
release (8.1).
b. We may switch the direction of this alias in 9.0. - Any new types going into
ext/spl
use theSpl
namespace. New
types added toext/spl
should be either related to data structures
or iterators, which is the bulk of what the SPL is.
a. This rule is to help prevent the SPL from becoming the dumping
grounds for new types. - We leave functions alone for now.
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 proposedCachedIterable
and company
which is inext/spl
, so this space has active development.
Thank you for your time.
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 proposedCachedIterable
and company
which is inext/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
- Any new types going into
ext/spl
use theSpl
namespace. New
types added toext/spl
should be either related to data structures
or iterators, which is the bulk of what the SPL is.
a. This rule is to help prevent the SPL from becoming the dumping
grounds for new types.
I think having this rule mentioned and agreed somewhere at least is a
good idea.
We could perhaps in future look at moving those parts currently labelled
as "spl" which don't fall into those categories somewhere else. It's
weird that you can now only use autoloading via a function prefixed
"spl_", even though it's a language feature.
Regards,
--
Rowan Tommins
[IMSoP]
Hello, everyone,
There has been a lot of disagreement about namespacing, and people
seem to have different viewpoints. I am not sure how to reconcile this
broader discussion.However, there are certain names in the global namespace which I am
hopeful we can revolve. For instance,SplObserver
,SplQueue
,
SplFixedArray
, etc all follow theSpl
prefix. There is already an
established "namespace" for these names.So here is my limited proposal:
- We create names in the
Spl
namespace that are aliases to their
equivalent types with theSpl
prefix:
Spl\FixedArray
-> SplFixedArray
Spl\Queue
-> SplQueue
a. The new names are the aliases so any code which uses
get_class($obj)
will not have the name change on them in a minor
release (8.1).
b. We may switch the direction of this alias in 9.0.- Any new types going into
ext/spl
use theSpl
namespace. New
types added toext/spl
should be either related to data structures
or iterators, which is the bulk of what the SPL is.
a. This rule is to help prevent the SPL from becoming the dumping
grounds for new types.- We leave functions alone for now.
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 proposedCachedIterable
and company
which is inext/spl
, so this space has active development.Thank you for your time.
--
To unsubscribe, visit: https://www.php.net/unsub.php
There's been a lull in feedback, so let me steer it towards a specific
point that was brought up: how do you feel about adding aliases from
\Spl\Thing to \SplThing?
On Thu, Feb 18, 2021 at 7:48 AM Levi Morrison
levi.morrison@datadoghq.com wrote:
Hello, everyone,
There has been a lot of disagreement about namespacing, and people
seem to have different viewpoints. I am not sure how to reconcile this
broader discussion.However, there are certain names in the global namespace which I am
hopeful we can revolve. For instance,SplObserver
,SplQueue
,
SplFixedArray
, etc all follow theSpl
prefix. There is already an
established "namespace" for these names.So here is my limited proposal:
- We create names in the
Spl
namespace that are aliases to their
equivalent types with theSpl
prefix:
Spl\FixedArray
-> SplFixedArray
Spl\Queue
-> SplQueue
a. The new names are the aliases so any code which uses
get_class($obj)
will not have the name change on them in a minor
release (8.1).
b. We may switch the direction of this alias in 9.0.- Any new types going into
ext/spl
use theSpl
namespace. New
types added toext/spl
should be either related to data structures
or iterators, which is the bulk of what the SPL is.
a. This rule is to help prevent the SPL from becoming the dumping
grounds for new types.- We leave functions alone for now.
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 proposedCachedIterable
and company
which is inext/spl
, so this space has active development.Thank you for your time.
--
To unsubscribe, visit: https://www.php.net/unsub.php
There's been a lull in feedback, so let me steer it towards a specific
point that was brought up: how do you feel about adding aliases from
\Spl\Thing to \SplThing?
It's been about a week. Current standings out of 33 total votes:
"I think they are important to the proposal." => 16 votes (~48%)
"I prefer them to not be aliased." => 11 votes (~33%)
"I don't care about them." => 6 votes (~18%)
I'll think more about the discussion so far and these results and then
either adjust or drop the proposal.