Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-25 Thread Derick Rethans
On Thu, 21 Feb 2008, Stefan Marr wrote: > jvlad schrieb: > > in other words, why to introduce such a new thing as trait instead of using > > classes and trait'ing them? > > I've introduced it as a separate notion from classes to avoid misconception > and problems occurring from conflicting propert

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-23 Thread Joshua Thompson
Another detail: The implementation of the parser changes should still allow a class or function called "trait", i.e. "trait" should only be a keyword at specific positions in the source to avoid unneccesary BC breaks. The current patch has this BC problem. This is not possible to implement, havi

Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-23 Thread Stefan Marr
Hi, Christian Schneider schrieb: I can see two use cases for aliasing: > 1) An interface uses a different name than the trait implements. Not sure that's a software design problem trait should try to solve. Well, no, aliasing shouldn't be used to achieve this, think it would be better to add

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-22 Thread Christian Schneider
Gregory Beaver schrieb: Christian Schneider wrote: Another detail: The implementation of the parser changes should still allow a class or function called "trait", i.e. "trait" should only be a keyword at specific positions in the source to avoid unneccesary BC breaks. The current patch has this

Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Lukas Kahwe Smith
On 22.02.2008, at 06:56, Gregory Beaver wrote: Another detail: The implementation of the parser changes should still allow a class or function called "trait", i.e. "trait" should only be a keyword at specific positions in the source to avoid unneccesary BC breaks. The current patch has this

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Gregory Beaver
Christian Schneider wrote: > So my favourite solution (apart from allowing include in class > definitions ;-)) would be > trait foo { ... } > ... > class B > { > trait foo; # All functions from foo > trait bar(a); # Only function a from bar > trait qux(not

Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Stefan Marr
Hi, jvlad schrieb: Why would this create any problems? Say, you have class B that extends class A and both do define one method and one property under the same names. Will this create a problem? No. It's because there are rules that clearly describe how it works (method and property will be ov

Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread jvlad
"Stefan Marr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > jvlad schrieb: >> in other words, why to introduce such a new thing as trait instead of >> using classes and trait'ing them? > I've introduced it as a separate notion from classes to avoid > misconception and pr

Re: [PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Stefan Marr
Hi, jvlad schrieb: in other words, why to introduce such a new thing as trait instead of using classes and trait'ing them? I've introduced it as a separate notion from classes to avoid misconception and problems occurring from conflicting properties and constant definitions. Your example dem

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread jvlad
Hi, what's about sample below? 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 in

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Christian Schneider
Gregory Beaver wrote: > Here is a slightly clearer syntax for trait instantiation and for > aliasing/removing method names from traits: > > trait foo ... > > class B > { > trait foo {unset bing, bar as bing}; > trait bar; > } I like the approach to reuse identifiers (trait both in dec

[PHP-DEV] Re: Trait aliasing syntax suggestions

2008-02-21 Thread Elizabeth M Smith
[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