On Mon Dec 20 06:21 PM, Stefan Marr wrote:
> 
> ===== Handling of Properties/State =====
>  
> This property handling was implemented in 
> [[http://svn.php.net/viewvc?view=revision&revision=306476|SVN revision 
> 306476]] and examples are given in the test cases.
> 

+1 

The E_STRICT warning seems to follow nicely the paper's view that a stateful
trait should be its own 'black-box':
http://scg.unibe.ch/archive/papers/Berg07eStatefulTraits.pdf

There are two remaining questions I have:
1) How do traits affect the reflection API?
2) Do we want to be able to declare trait requirements for properties and
methods? If so what syntax?

A note on the syntax proposed by Nathan:
trait require Foo

An option could be:

trait Foo {
  require {
     public $var;
     function ratio();
  }

  function doFoo($v) {
     $this->var = $v * $this->ratio();
  }
}

trait Bar {
  require interface Iterator;
}

The idea comes from:
http://code.google.com/p/es-lab/wiki/Traits

I found this trying to look for alternative keyword for 'require'.



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to