Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Christopher Jones
On 11/16/11 6:12 PM, Rasmus Schultz wrote: who can hook me up with a login, so I can contribute to the documentation? You can do it as an "anonymous" user on edit.php.net. Join in the chat so you can prod someone to merge your changes - you might also need to remind the doc mail list. Once

Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Rasmus Schultz
who can hook me up with a login, so I can contribute to the documentation? > Here's a better example of something useful that actually works: >> > > Assuming your example is OK, you could edit the doc and submit it as a > patch at https://edit.php.net. > >

Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Stefan Marr
Hi Rasmus: On 16 Nov 2011, at 01:17, Rasmus Schultz wrote: > I knew about the traits features in Scala, and I guess I assumed this would > be similar - not so. Right, they are not the same. PHP's traits are much closer to the notion of traits introduced in the Smalltalk world, while Scala's trai

Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Richard Quadling
On 16 November 2011 00:17, Rasmus Schultz wrote: > Here's a better example of something useful that actually works: > >  trait Accessors >  { >    public function __get($name) >    { >      return $this->{'get'.$name}(); >    } > >    public function __set($name, $value) >    { >      $this->{'set

Re: [PHP-DEV] some notes about traits

2011-11-15 Thread Christopher Jones
On 11/15/11 4:17 PM, Rasmus Schultz wrote: So I guess my remaining quibble is that the documentation needs to relay this somehow - with a basic real-world example that actually uses an interface too, to clarify the difference, and to demonstrate how this tool use useful in conjunction with cla

Re: [PHP-DEV] some notes about traits

2011-11-15 Thread Rasmus Schultz
Hi Stefan, Appreciate you taking the time to discuss this - and I apologize if I jumped the gun with some of these comments. I knew about the traits features in Scala, and I guess I assumed this would be similar - not so. Reading through my own remarks and your comments, I now have a better unde

Re: [PHP-DEV] some notes about traits

2011-11-11 Thread Stefan Marr
Hi Rasmus: First, sorry, I don't have currently the time to reiterate all discussions on these questions. Please, do me the favor and search the archives for previous discussions. I believe _all_ points you raise here have been discussed and commented before, and most of them quite recently. Si

Re: [PHP-DEV] some notes about traits

2011-11-11 Thread Johannes Schlüter
I keep most of this to other but two comments: On Fri, 2011-11-11 at 11:00 -0500, Rasmus Schultz wrote: > Lastly, when you reflect on a trait, it comes back as an instance of > ReflectionClass. As pointed out, traits are probably more similar to > interfaces than they are to classes, and they defi

[PHP-DEV] some notes about traits

2011-11-11 Thread Rasmus Schultz
It seems to me, there's a couple of things related to traits that were missed in this implementation. Take the following example: script terminates public function addItem($item, $amount=1) { echo "Adding {$amount} {$item->getName()} to shopping cart - price = ".($amount * $item->getPric