Hi Nathan:
On 09 Dec 2010, at 08:44, Nathan Nobbe wrote:
> 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.
Why would you need such a check?
You want to ensure that the class that is using your trait obeys a certain
interface, right?
More specifically, you need it to implement a number of methods of an
interface, correct?
So, why not asking for it explicitly?
<?php
trait InnerIteratorImpl {
abstract function next();
public function apply() {
do somthing with $this->next() ...
}
}
?>
Does that what you want it to do?
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php