# SplObjectStorage

- Thread: https://externals.io/message/21705
- Original archive: https://news-web.php.net/php.internals/21705
- Started by Jeff Moore on 2006-01-27T16:37:09+00:00
- Messages: 11
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #21705 — Jeff Moore — 2006-01-27T16:37:09+00:00

URL: https://externals.io/message/21705#21705

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

---

## #21708 — Marcus Boerger — 2006-01-27T18:10:50+00:00

URL: https://externals.io/message/21705#21708 · In reply to: #21705

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

---

## #21709 — Jeff Moore — 2006-01-27T19:23:26+00:00

URL: https://externals.io/message/21705#21709 · In reply to: #21708

Hi, Marcus,



>   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

---

## #21711 — Marcus Boerger — 2006-01-28T03:26:19+00:00

URL: https://externals.io/message/21705#21711 · In reply to: #21709

Hello Jeff,

 what the hell do you want?

Friday, January 27, 2006, 8:23:26 PM, you wrote:

> Hi, Marcus,

> 

> > […]

> So why not call it a container instead of storage?

> > […]

> 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

---

## #21712 — Jeff Moore — 2006-01-28T05:47:54+00:00

URL: https://externals.io/message/21705#21712 · In reply to: #21711

>  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

---

## #21713 — Kevin Waterson — 2006-01-28T21:08:39+00:00

URL: https://externals.io/message/21705#21713 · In reply to: #21712

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."

---

## #21714 — Bart de Boer — 2006-01-28T23:30:06+00:00

URL: https://externals.io/message/21705#21714 · In reply to: #21713

Kevin Waterson wrote:
> This one time, at band camp, Jeff Moore <jeff@procata.com> wrote:
> 
> 
> > […]
> 
> Why not just call it Betty.
> 
> Kevin
> 
> 

+1 for Betty!

---

## #21736 — Jeff Moore — 2006-01-30T18:11:53+00:00

URL: https://externals.io/message/21705#21736 · In reply to: #21713

> > […]
>
> 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

---

## #21737 — Johannes Schlueter — 2006-01-30T18:33:31+00:00

URL: https://externals.io/message/21705#21737 · In reply to: #21736

Hi Jeff,


> > […]
>
> 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

---

## #21739 — Jeff Moore — 2006-01-30T19:04:02+00:00

URL: https://externals.io/message/21705#21739 · In reply to: #21737

> "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

---

## #21740 — Antony Dovgal — 2006-01-30T19:57:32+00:00

URL: https://externals.io/message/21705#21740 · In reply to: #21739

> 
> 
> > […]
> 
> There are many ways to store objects.  Arrays can store objects, too.  
> What makes this class different?
> 
> > […]
> 
> 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
