Guido van Rossum wrote: > I realize that Java- and Zope-style interfaces *seem* to be all about > syntax (they define names and signatures of methods but not semantics) > but IMO that's only a theoretical objection; in *practice* these > interfaces have strong connotations of semantics (albeit written in > Enlish rather than using assertions or pre- and post-conditions) and > nobody would think of claiming to implement an interface without > implementing the proper semantics (or some interpretation thereof :-)
Actually, plenty of people would dream of it and even do it. I've seen some pretty evil implementations of Java interfaces. All they can enforce is static types and method signatures. My main point is, unless you're willing to go whole-hog with pre- and post-conditions (and even that would be insufficient, as you can't check anything like "this eventually, on some call, responds with x" without spelling it out in temporal logic and running model checking software), no interface can enforce anything *semantically* meaningful. The most useful thing an interface can do is *communicate* semantics to another programmer. I'm not sure I said anything Guido didn't already say, but I wanted to make the distinction between *enforcing* correct behavior and *communicating* correct behavior. Java (and Zope, apparently) simply have a more formal way of doing this. Stock Python doesn't. Neil _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com