I have always liked the idea of having protocols say more than just "these are the functions and these are the arguments, which are optional, ane maybe what their types are.
You can have that in Lisp to a point with Interface-Passing Style: http://fare.livejournal.com/155094.html
I'd love it if there were a way to say "in order to fulfill this contract, doing write-string of a string must behave exactly the same as doing write-char on each."
Common Lisp seems to be opposed to the idea of static checking of anything. Racket has a nice dynamic contract system, however, as well as a statically typed dialect, and the two play nice together.
You could imagine all kinds of integrity constratints. You could specify that some function be commutative, that some be associative with respect to each other, that one have no side effects, that one be idempotent, and so on. We could start by having a well-known template for documenting/commenting the functions in a protocol to be able to say things like this.
Such constraints are usually extremely expensive to verify dynamically, to the point of being prohibitively expensive for large runs, though you could verify only during test runs. They are also expensive to verify statically, but then the cost is finite and you only have to pay it once upfront, not all the time. Some languages like Cayenne, Epigram or Omega, that allow you to specify (and prove) all these constraints statically.
Patterns mean "I have run out of language." — Rich Hickey
Actually even the Gang-of-Four admit that.
Somehow, the message was lost — probably to themselves, to start with — for the popularity of their work has led to no improvement to the ability of languages not to run out.
[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Faith, n: That quality which enables us to believe what we know to be untrue.