Hi:

On 14 Oct 2009, at 22:44, Tom Boutell wrote:

I'm very concerned about the practical consequences of introducing
traits without state.
Well, we have not found a sufficient design until now, which would fit nicely into PHP from dynamic and simplicity perspective.

A. They could do this using static hashes in global variables or a
separate class. The result is a garbage collection failure as these
references to $this will never go away. Designed-in GC failures are
unacceptable post PHP 5.3.
Doing this would be less than advisable.


B. PHP allows you to define properties at runtime. That is, you can write:

$this->title = 'my title';

Without declaring var $title; at the class level.

But PHP 6 seems to be moving toward more strictness, not less, and
this style encourages the use of undeclared variables with the
resulting potential for missed bugs.
Thats the currently preferred approach from my perspective.
The only thing you are going to lose here is a notion of separation of state from different traits, compared to a language supported approach.

However, if you prefer to be more strict, it is still perfectly possible to circumvent this problem by using getters and setters.


Also, the 'instead' keyword is baffling - it could mean replace A with
B or replace B with A depending on how you place your mental comma - I
much prefer the assignment syntax alternative, or 'insteadof' which is
unambiguous.
Yes, that was discussed before, but unfortunately did not make it into the list of alternative syntaxes, will try to keep track of it.

Best regards
Stefan




On Wed, Oct 14, 2009 at 4:07 PM, Lukas Kahwe Smith <m...@pooteeweet.org> wrote:

On 14.10.2009, at 22:03, Stanislav Malyshev wrote:

Hi!

So lets warm this up again.
HEAD is for development .. so lets get this into HEAD so that it will be
part of the next bigger PHP release for sure!

Well, the code is sitting here
http://github.com/gron/php-src/tree/PHP_6-traits
and waits to be merged. :)

I thought before merging code it would be useful to have some discussion
on if the code is actually doing what we want. If it's based on
http://wiki.php.net/rfc/horizontalreuse then for example I can see some potential issues for bytecode caching related to renaming and changing
visibility.
Also, it is not clear that we want grafts there at all, some aspects of
them seem to get too hairy, esp. $this issue or statics.


i think Stefan is fully aware of that probably there will be a discussion
first ..
but i think we all agree that this feature is very high on the list of what people want and therefore i wanted to get this discussion going, so that
after its concluded traits can be commited to HEAD.

regards,
Lukas Kahwe Smith
m...@pooteeweet.org




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php





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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to