Re: [PHP-DEV] some notes about traits

2011-11-16 Thread Richard Quadling
On 16 November 2011 00:17, Rasmus Schultz ras...@mindplay.dk 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)    {      

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

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 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-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

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

[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: ?php header('Content-type: text/plain'); class Cart { public static $instance; # public function addItem(CartBehavior $item, $amount=1) // = script terminates

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.