# Traits

- Thread: https://externals.io/message/48649
- Original archive: https://news-web.php.net/php.internals/48649
- Started by Christian Kaps on 2010-06-04T11:46:32+00:00
- Messages: 5
- 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

---

## #48649 — Christian Kaps — 2010-06-04T11:46:32+00:00

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

A short while ago there was a discussion about implementing Traits in
the next PHP version. How is the status of this?

---

## #48650 — Stefan Marr — 2010-06-04T11:56:40+00:00

URL: https://externals.io/message/48649#48650 · In reply to: #48649

Hi:



> A short while ago there was a discussion about implementing Traits in
> the next PHP version. How is the status of this?

The code is committed to trunk, and thanks to the community there have already been some improvements and fixes for corner cases.
We even got some basic reflection capabilities, too.

So, it is there. Now it is just a matter of defining a release and either including it or not...

Best regards
Stefan

PS: Snapshots are here http://snaps.php.net/

---

## #48651 — Christian Kaps — 2010-06-04T12:13:41+00:00

URL: https://externals.io/message/48649#48651 · In reply to: #48650

That sounds good and I hope it will be included in the next release.

Best regards,
Christian


> Hi:
>
> 
>
>   
> > […]
> The code is committed to trunk, and thanks to the community there have already been some improvements and fixes for corner cases.
> We even got some basic reflection capabilities, too.
>
> So, it is there. Now it is just a matter of defining a release and either including it or not...
>
> Best regards
> Stefan
>
> PS: Snapshots are here http://snaps.php.net/

---

## #49551 — Tom Boutell — 2010-08-27T14:43:33+00:00

URL: https://externals.io/message/48649#49551 · In reply to: #48651

What was the status of data for traits in the implementation that went
into trunk?

Would one have to do that by creating public properties that aren't
formally defined?

On Fri, Jun 4, 2010 at 8:13 AM, Christian Kaps
<christian.kaps@mohiva.com> wrote:
> That sounds good and I hope it will be included in the next release.
>
> Best regards,
> Christian
>
>
> > […]
>
>
> --
> 
> 
>
>



-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

---

## #49553 — Stefan Marr — 2010-08-28T16:52:09+00:00

URL: https://externals.io/message/48649#49553 · In reply to: #49551

Hi Tom:

The status is still identical to what the RFC says + some extensions to the reflection API.

Thus, you can define properties in Traits just like in classes, and I would encourage you to do so, if that is the way you use PHP. However, there is no conflict detection with other traits. Thus, you have to make sure that your property names are descriptive and unique over all traits you combine.

Finding a solution for that problem wasn't possible so far. At least not in a way that makes people happy i.e. avoids tons of complex and rather academic constructs to ensure that you get what you want with respect to state.

Hope that helps
Best regards
Stefan




> What was the status of data for traits in the implementation that went
> into trunk?
> 
> Would one have to do that by creating public properties that aren't
> formally defined?
> 
> On Fri, Jun 4, 2010 at 8:13 AM, Christian Kaps
> <christian.kaps@mohiva.com> wrote:
> > […]
> 
> 
> 
> -- 
> Tom Boutell
> P'unk Avenue
> 215 755 1330
> punkave.com
> window.punkave.com
> 
> -- 
> 
> 
> 

-- 
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525
