# Implicit Reference

- Thread: https://externals.io/message/60526
- Original archive: https://news-web.php.net/php.internals/60526
- Started by Mathias Grimm on 2012-05-10T19:38:26+00:00
- Messages: 3
- 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

---

## #60526 — Mathias Grimm — 2012-05-10T19:38:26+00:00

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

There is a suching extension to handle (intercepts) implicit (or no)
reference.

Ex.:

$a = new A():
$b = $a;

I want something like __clone(), something like __reference() to be invoked
in the second line of the given example.

Thanks.

-- 
Mathias Grimm

---

## #60527 — Ivan Enderlin @ Hoa — 2012-05-10T20:34:57+00:00

URL: https://externals.io/message/60526#60527 · In reply to: #60526

Hi Mathias,


> There is a suching extension to handle (intercepts) implicit (or no)
> reference.
>
> Ex.:
>
> $a = new A():
> $b = $a;
>
> I want something like __clone(), something like __reference() to be invoked
> in the second line of the given example.
Do you have a usecase?

Best regards.

-- 
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/

---

## #60528 — Devis Lucato — 2012-05-10T22:33:29+00:00

URL: https://externals.io/message/60526#60528 · In reply to: #60527

Hi,

I had a possible use case while working with an application registry.  Any
model could "get a copy" of it to read application settings or retrieve a
resource.  However if a model by mistake changed a property, it would
modify the original object without going through proper setters... A quick
solution was to use "clone" whenever returning the registry.

Best regards


On 10 May 2012 21:34, Ivan Enderlin @ Hoa <ivan.enderlin@hoa-project.net>wrote:

> Hi Mathias,
>
>
> 
>
> > […]
> Do you have a usecase?
>
> Best regards.
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/ or http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
