# WeakMap vs PECL WeakMap

- Thread: https://externals.io/message/108203
- Original archive: https://news-web.php.net/php.internals/108203
- Started by Benjamin Morel on 2020-01-20T13:58:06+00:00
- Messages: 2
- RFC: Weak maps (Implemented (PHP 8.0)) — https://externals.io/rfc/weak_maps.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #108203 — Benjamin Morel — 2020-01-20T13:58:06+00:00

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

Hi Internals,

A year ago, when WeakRef was being proposed, some objections
<https://externals.io/message/104014#104068> related to the PECL Weakref
package <https://www.php.net/manual/fr/book.weakref.php> had lead the RFC
author, Joe Watkins, to rename WeakRef to WeakReference to avoid conflicts.

However, the latest addition from Nikita Popov, WeakMap
<https://wiki.php.net/rfc/weak_maps>, did not take the same argument into
account, therefore conflicting with PECL WeakMap
<https://www.php.net/manual/fr/class.weakmap.php>.

*First of all, how will this be handled in the docs?*

Now that we have a conflict on WeakMap anyway, and now that the PECL
package has been deprecated, and provided that the conflict can be
gracefully handled in the docs, *is there anything that prevents
WeakReference from being called WeakRef?*

Could we have both names in PHP 8, like WeakReference being an alias for
WeakRef?

Thank you,
Benjamin

---

## #108264 — Nikita Popov — 2020-01-27T09:51:31+00:00

URL: https://externals.io/message/108203#108264 · In reply to: #108203

On Mon, Jan 20, 2020 at 2:58 PM Benjamin Morel <benjamin.morel@gmail.com>
wrote:

> Hi Internals,
>
> A year ago, when WeakRef was being proposed, some objections
> <https://externals.io/message/104014#104068> related to the PECL Weakref
> package <https://www.php.net/manual/fr/book.weakref.php> had lead the RFC
> author, Joe Watkins, to rename WeakRef to WeakReference to avoid conflicts.
>
> However, the latest addition from Nikita Popov, WeakMap
> <https://wiki.php.net/rfc/weak_maps>, did not take the same argument into
> account, therefore conflicting with PECL WeakMap
> <https://www.php.net/manual/fr/class.weakmap.php>.
>
> *First of all, how will this be handled in the docs?*
>
> Now that we have a conflict on WeakMap anyway, and now that the PECL
> package has been deprecated, and provided that the conflict can be
> gracefully handled in the docs, *is there anything that prevents
> WeakReference from being called WeakRef?*
>
> Could we have both names in PHP 8, like WeakReference being an alias for
> WeakRef?
>

I don't see a point in renaming the class now that the WeakReference name
has been chosen. I don't agree with the reasons *why* it was picked, but
it's not like "WeakReference" is a bad name in itself. That's what Java
calls it as well, for example.

Regards,
Nikita
