Hi,
have updated the RFC and added several syntax proposals.
Additionally I've ported the patch to PHP_5_3
(http://toolslave.net/snapshots/traits/traits-5.3.patch).
Kind Regards
Stefan
:Version: 1.2
:HTML: http://www.stefan-marr.de/artikel/rfc-traits-for-php.html
:TXT: http://www.stefan-marr.de/rfc-traits-for-php.txt
Alternative Syntax Proposals
----------------------------
This section collects proposals for alternative Traits syntaxes.
Alternative Keywords for use
""""""""""""""""""""""""""""
The keyword use is already reserved for the new namespace feature.
Thus, alternative keywords has been proposed on the mailing list.
The general idea remains the same, Trait usage is defined in the class body
like this::
class Foo { class Foo {
exhibit Bar; possess Bar;
} }
Proposed keywords:
* use (but already used for namespaces)
* exhibit or exhibits (not basic vocabulary?)
* possess or possesses (hard to write?)
* attach
* acquire
* adopt
* apply
* has
* consume
* implement (almost the like ``implements``)
* include (but also ambiguous)
* trait
Alternative Expression of Exclusion
"""""""""""""""""""""""""""""""""""
Some people do not like the notation with the exclamation mark.
Possible alternative keywords for following notation style::
use Trait { use Trait {
not foo1, foo2; without foo1, foo2;
} }
Keywords:
* ! (not readable?)
* not
* hide (not exactly the meaning of exclusion)
* ignore
* without
* unset
* except (may be mistaken with exception stuff)
Alternatives for the Aliasing Notation
""""""""""""""""""""""""""""""""""""""
Aliasing is often misunderstood as renaming.
May be some of the following notations will help::
[1] is keyword instead of the arrow
use Trait {
bar is foo1; //methodAlias is method
}
Interpretation: ``is`` state something about ``bar``, there is nothing
stated
about ``foo1``.
Alternative keyword for the same notation meaning:
* as
* alias
* from
Or an very explicit variation::
[2] from
use Trait {
alias bar as foo1;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php