[PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
On Wed, 12 Mar 2003, Marcus Boerger wrote: helly Tue Mar 11 19:10:00 2003 EDT Added files: /php4/tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt Log: Added some interface tests I have 2 questions: 1. Do the interface functions have to be explicitly specified as abstract? interface Foo { function bar(); } Because this runs fine for me with no errors. 1. What is the difference between the following: interface Foo { } class Boo extends Foo { } and class Zoo implements Foo { } -Andrei http://www.gravitonic.com/ In this age, which believes that there is a short cut to everything, the greatest lesson to be learned is that the most difficult way is, in the long run, the easiest. -Henry Miller, The Books in My Life -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
At 14:53 12.03.2003, Andrei Zmievski wrote: I have 2 questions: 1. Do the interface functions have to be explicitly specified as abstract? interface Foo { function bar(); } Because this runs fine for me with no errors. They don't have to (currently) I weote the tests with abstract as i thought this could be changed. 1. What is the difference between the following: interface Foo { } class Boo extends Foo { } and class Zoo implements Foo { } a class can only extend ONE class/interface but it can implement multiple interfaces. If you ask me i would not allow extending interfaces at all. regards marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
On Wed, 12 Mar 2003, Marcus Börger wrote: a class can only extend ONE class/interface but it can implement multiple interfaces. If you ask me i would not allow extending interfaces at all. That's what I was thinking too. -Andrei http://www.gravitonic.com/ For every complex problem, there is a solution that is simple, neat, and wrong. -- H. L. Mencken -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
On Wed, 12 Mar 2003, Sebastian Bergmann wrote: I have seen extended interfaces quite often in the Java world. IIRC, the following code currently runs without problems and it should stay that way, if it does not harm us in any way: ?php interface Foo {} interface Bar extends Foo {} class FooBar implements Bar {} ? I wasn't talking about interfaces extending interfaces - that is perfectly fine. I was saying that class blah extends interface and class blah implements interface is confusing. -Andrei http://www.gravitonic.com/ When we eliminate the impossible, whatever remains, however improbable, must be true. -- Sherlock Holmes -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
At 19:57 12.03.2003, Shane Caraveo wrote: A class extending an interface seems just weird to me. classes should only extend classes, and implement interfaces. interfaces can extend interfaces. I haven't been following the interfaces stuff (I'm going to have to backtrack and read it all, very happy if this stuff will do what I want), but I would hope we have some capability of implementing multiple interfaces in a class somehow. interface JAZ {} interface FOO {} interface BAR extends FOO {} class foo implements FOO {} This works even though i do not like extends FOO. class foobar extends foo implements (BAR,JAZ) {} This doesn't - i hope - trying - ?php interface a {} interface b {} class c implements (a,b) {} /usr/src/php4-HEAD/-(4) : Parse error - parse error, unexpected '(', expecting T_STRING or T_PAAMAYIM_NEKUDOTAYIM or T_NAMESPACE_NAME You have to do class foobar extends foo implements BAR,JAZ {} marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
On Wed, 12 Mar 2003, Marcus Börger wrote: interface JAZ {} interface FOO {} interface BAR extends FOO {} class foo implements FOO {} This works even though i do not like extends FOO. Why? Both C# and Java (AFAIR) allow interfaces to extend other interfaces. This doesn't - i hope - trying - ?php interface a {} interface b {} class c implements (a,b) {} /usr/src/php4-HEAD/-(4) : Parse error - parse error, unexpected '(', expecting T_STRING or T_PAAMAYIM_NEKUDOTAYIM or T_NAMESPACE_NAME You have to do class foobar extends foo implements BAR,JAZ {} I think we should disallow classes extending interfaces. Only 'implements' should be supported. -Andrei http://www.gravitonic.com/ We all have photographic memories, it's just that some of us don't have any film. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
At 20:20 12.03.2003, Andrei Zmievski wrote: On Wed, 12 Mar 2003, Marcus Börger wrote: This works even though i do not like extends FOO. Why? Both C# and Java (AFAIR) allow interfaces to extend other interfaces. Because of the second part of the answer. It is a little bit strange that an interface can extend and implement an interface but a class can only implement interfaces. Also it is a bit weired that i can implement multiple interface but extend only one. Hey these two words sound different and should have a clearly different meaning. I think we should disallow classes extending interfaces. Only 'implements' should be supported. As said already: yes. marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
At 08:53 AM 3/12/2003 -0500, Andrei Zmievski wrote: I have 2 questions: 1. Do the interface functions have to be explicitly specified as abstract? Nope. It shouldn't be allowed to be abstract because it's abstract by definition. interface Foo { function bar(); } Because this runs fine for me with no errors. 1. What is the difference between the following: interface Foo { } class Boo extends Foo { } This shouldn't work. I guess there's a bug someplace. It's new code so I'm sure there will be some small things which need to be fixed. Andi and class Zoo implements Foo { } -Andrei http://www.gravitonic.com/ In this age, which believes that there is a short cut to everything, the greatest lesson to be learned is that the most difficult way is, in the long run, the easiest. -Henry Miller, The Books in My Life -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /tests/classes interface_class.phpt interface_doubled.phpt interface_implemented.phpt interface_instantiate.phpt interface_member.phpt interface_method.phpt interface_method_final.phpt interface_method_private.phpt interface_must_be_implemented.phpt
At 21:12 12.03.2003, Shane Caraveo wrote: An interface should not implement an interface, only classes should implement interfaces. 'implement' infers that actual executable code is provided that implements an interface. Again, I haven't followed the interface stuff, and sorry for writting without reading the background, but I'm working off the assumption that interfaces are kind of like IDL. We do not force classes to directly implement (supply code) for an interface method (and i do like that (now)). ok: interface extends interface class extends class implements interface not ok: interfaces implements interface class extends interface I would favor this: interface [ implements interface+ ] class [ extends class ] [ implements interface+ ] or less: interface [ extends interface+ ] class [ extends class ] [ implements interface+ ] I like the former more because it separates classes to extends and interfaces to implements and does not suggest MI. Howeve the latter has some more kind of logic since an interface extends other interfaces when they are inherited. (Maybe i'll change my mind after sleeping it over). i'm sure you know to write it correctly with the missing ',' :-)) marcus -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php