Hi,
I think traits will lend themselves to frequent runtime checking against the
type of class in which they were used. Consider a trait designed for use
with an Iterator class; the first thing might be to check the type of $this.
<?php
trait InnerIteratorImpl {
public function apply() {
if(!$this instanceof Iterator)
throw new UnexpectedValueException(get_class($this) . ' not an
Iterator ..');
...
}
}
?>
do you not think checks like this will be common / messy / performance
costly; is there something i'm missing?
thx,
-nathan