Re: Trait aliasing syntax suggestions
| From: | Elizabeth M Smith | Date: | Sun, 10 Feb 2008 14:17:49 +0000 |
| Subject: | Re: Trait aliasing syntax suggestions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35691@lists.php.net to get a copy of this message | ||
[snip...]
>
> class A
> {
> trait foo;
> }
>
> class B
> {
> trait foo {unset bing, bar as bing};
> trait bar;
> }
> ?>
>
[snip...]
As long as we're discussing syntax - I rather like
class A
{
attach foo;
}
class B
{
attach foo {hide bing, bar as bing};
attach bar;
}
but that's just my opinion into the "how to do the syntax" discussion
I do like the "foo as bar" style aliasing, it will really make sense as
namespaces follow the same convention, but I think hide is more
appropriate than unset
As for attach keyword, well it's short and descriptive, you are
attaching new functionality to the class. I think that reusing trait
both as the way to put the trait in the class and to declare the trait
will confuse people.
My $0.02
Thanks,
Elizabeth Smith