SplObjectStorage

php.internals

Jeff Moore

20 years ago
SplObjectStorage: "This container allows to store objects uniquly without the need to compare them one by one." Unless I'm mistaken, in Java and Mathematics, this is called a Set. "A collection that contains no duplicate elements." Is there some reason not to name the class for the general concept? Is there a reason to limit this class to object members? Best Regards, Jeff Moore

Marcus Börger

20 years ago
Hello Jeff, yes, it is a conainer and not a set. And it cannot take anything other than php objects. That's why. Friday, January 27, 2006, 5:37:09 PM, you wrote:
> SplObjectStorage:
> "This container allows to store objects uniquly without the need to > compare them one by one."
> Unless I'm mistaken, in Java and Mathematics, this is called a Set.
> "A collection that contains no duplicate elements."
> Is there some reason not to name the class for the general concept? Is > there a reason to limit this class to object members?
> Best Regards,
> Jeff Moore
Best regards, Marcus

Jeff Moore

20 years ago
Hi, Marcus, On Jan 27, 2006, at 1:10 PM, Marcus Boerger wrote:
> yes, it is a conainer and not a set.
So why not call it a container instead of storage?
> And it cannot take anything other > than php objects. That's why.
SplObjectContainer? But, then, it has that uniqueness constraint. The SplObjectStorage name doesn't convey that idea at all. SplUniqueObjectContainer? From an API standpoint (rather than an implementation standpoint), I don't understand the need for the object only constraint in PHP. SplUniqueZvalContainer? SplUniqueValueContainer? SplUniqueMemberContainer? Yours, Jeff

Marcus Börger

20 years ago
Hello Jeff, what the hell do you want? Friday, January 27, 2006, 8:23:26 PM, you wrote:
> Hi, Marcus,
> On Jan 27, 2006, at 1:10 PM, Marcus Boerger wrote:
>> yes, it is a conainer and not a set.
> So why not call it a container instead of storage?
>> And it cannot take anything other >> than php objects. That's why.
> SplObjectContainer?
> But, then, it has that uniqueness constraint. The SplObjectStorage > name doesn't convey that idea at all.
> SplUniqueObjectContainer?
> From an API standpoint (rather than an implementation standpoint), I > don't understand the need for the object only constraint in PHP.
> SplUniqueZvalContainer? > SplUniqueValueContainer? > SplUniqueMemberContainer?
> Yours,
> Jeff
Best regards, Marcus

Jeff Moore

20 years ago
On Jan 27, 2006, at 10:26 PM, Marcus Boerger wrote:
> what the hell do you want?
To give SplObjectStorage a better name. My best suggestion is SplUniqueObjectContainer. There may be a better choice. Best Regards, Jeff

Kevin Waterson

20 years ago
This one time, at band camp, Jeff Moore <jeff@procata.com> wrote:
> To give SplObjectStorage a better name. My best suggestion is > SplUniqueObjectContainer. There may be a better choice.
Why not just call it Betty. Kevin
-- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."

Bart de Boer

20 years ago
Kevin Waterson wrote:
> This one time, at band camp, Jeff Moore <jeff@procata.com> wrote: > > >> To give SplObjectStorage a better name. My best suggestion is >> SplUniqueObjectContainer. There may be a better choice. > > Why not just call it Betty. > > Kevin > >
+1 for Betty!

Jeff Moore

20 years ago
On Jan 28, 2006, at 4:08 PM, Kevin Waterson wrote:
>> To give SplObjectStorage a better name. My best suggestion is >> SplUniqueObjectContainer. There may be a better choice. > > Why not just call it Betty.
Why not? "Betty" is only slightly more vague than "Storage." A vague name is nobody's friend. Here is a sitepoint thread where a use of SplObjectStorage is discussed. http://www.sitepoint.com/forums/showthread.php?t=339769 I'm just trying to point out that the class may have a broader use than the context in which it was conceived and that the name could better reflect its function. AFAIK, SplObjectStorage is targeted for PHP 6. I'm not suggesting changing something that has been in PHP for half a decade. Is this not the appropriate time and place to give feedback about API design issues? Best Regards, Jeff

Johannes Schlueter

20 years ago
Hi Jeff, On Monday 30 January 2006 19:11, Jeff Moore wrote:
> > Why not just call it Betty. > > Why not? "Betty" is only slightly more vague than "Storage." A vague > name is nobody's friend.
"SplObjectStorage" is some thing which stores objects, that can be read out of the name so it at least gives an idea and compared to your "SplUniqueObjectContainer" it's quite short.
> AFAIK, SplObjectStorage is targeted for PHP 6. I'm not suggesting > changing something that has been in PHP for half a decade. Is this not > the appropriate time and place to give feedback about API design > issues?
It's part of PHP 5.1.2. johannes

Jeff Moore

20 years ago
On Jan 30, 2006, at 1:33 PM, Johannes Schlueter wrote:
> "SplObjectStorage" is some thing which stores objects, that can be > read out of > the name so it at least gives an idea and compared to your > "SplUniqueObjectContainer" it's quite short.
There are many ways to store objects. Arrays can store objects, too. What makes this class different?
> It's part of PHP 5.1.2.
I didn't realize that. If I had, I probably wouldn't have posted in the first place. These things get in so fast and I rarely see any discussion on them. My goal in posting was to provoke some discussion before it was released. Best Regards, Jeff

Antony Dovgal

20 years ago
On 30.01.2006 22:04, Jeff Moore wrote:
> On Jan 30, 2006, at 1:33 PM, Johannes Schlueter wrote: > >> "SplObjectStorage" is some thing which stores objects, that can be >> read out of >> the name so it at least gives an idea and compared to your >> "SplUniqueObjectContainer" it's quite short. > > There are many ways to store objects. Arrays can store objects, too. > What makes this class different? > >> It's part of PHP 5.1.2. > > I didn't realize that. If I had, I probably wouldn't have posted in > the first place. These things get in so fast and I rarely see any > discussion on them.
It was added Sept. 15, while 5.1 was released 3 (three) months later (Dec. 19). (See here: http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_observer.c?view=log) I think 3 months is more than enough time to discuss a name of a class. Actually, betas and RCs are released exactly for that - to discuss and to test new changes and additions.
-- Wbr, Antony Dovgal