Re: RfC: rethink OO inheritance strictness
| From: | Pierre | Date: | Mon, 07 Aug 2006 11:48:17 +0000 |
| Subject: | Re: RfC: rethink OO inheritance strictness | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-25230@lists.php.net to get a copy of this message | ||
On 8/7/06, Jochem Maas <jochem@iamjochem.com> wrote:
Pierre wrote: Hello, On 8/7/06, Marcus Boerger <helly@php.net> wrote:}class Foo {}public interface function myFoo($x) { echo $x; } // strictmethod signature enforcedclass Bar extends Foo {public function myFoo() { echo "bar"; } // this would beE_FATAL
class Qux extends Foo {
public interface function myFoo($x) { echo $x; } // this is
okay.
}
Hmm i see some elegance here :-)OT: that's a nice thing for a 'php mug' to hear coming from a 'php dev' :-) This is exactly what has been proposed last week, add a keyword to the declaration to mark a method as strict. having reread the thread this does seem to be pretty much the case, although my suggestion saves on adding a new keyword and by reusing the 'interface' keyword hopefully sparks, in the mind of the developer, the direct correlation between interfaces and strict methods. Yes, but the idea is the same. It requires to explicitelly declare a method as strict using an extra keyword. Using 'Interface' as keyword makes sense, obviously :) Cheers, --Pierre