Hi,
what's about sample below?
<?php
class foo
{
public $aabb;
const bbaa = 'abba';
static public $baba;
function bar(){}
function bing(){}
}
class bar
{
const baab = foo::bbaa;
function bar(){}
}
class A
{
trait foo;
}
class B
{
trait foo {unset bing, bar as bing, unset $aabb, unset bbaa};
trait bar;
}
?>
in other words, why to introduce such a new thing as trait instead of using
classes and trait'ing them?
just my two cents.
-j
"Gregory Beaver" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Here is a slightly clearer syntax for trait instantiation and for
> aliasing/removing method names from traits:
>
> <?php
> trait foo
> {
> function bar(){}
> function bing(){}
> }
>
> trait bar
> {
> function bar(){}
> }
>
> class A
> {
> trait foo;
> }
>
> class B
> {
> trait foo {unset bing, bar as bing};
> trait bar;
> }
> ?>
>
> Simply re-using "trait" instead of "use" is a more self-documenting
> solution. I found it slightly confusing to see "use" when that is a
> namespace-specific token currently. This is also in keeping with the
> way functions are defined in interfaces vs. implementation, but in
> reverse (for traits, brackets are used for declaration, semi-colon used
> for instantiation).
>
> Obviously, using "unset" is more similar to current PHP ideas on how to
> remove something, and the "as" syntax is also very PHP-ish, these will
> be far more self-documenting than the proposed syntaxes I've read thus
> far.
>
> Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php