Darren New schrieb: > There are also problems with the complexity of things. Imagine a > chess-playing game trying to describe the "generate moves" routine. > Precondition: An input board with a valid configuration of chess pieces. > Postcondition: An array of boards with possible next moves for the > selected team. Heck, if you could write those as assertions, you > wouldn't need the code.
Actually, in a functional programming language (FPL), you write just the postconditions and let the compiler generate the code for you. At least that's what happens for those FPL functions that you write down without much thinking. You can still tweak the function to make it more efficient. Or you can define an interface using preconditions and postconditions, and write a function that fulfills these assertions (i.e. requires no more preconditions than the interface specifies, and fulfills at least the postcondition that the interface specifies); here we'd have a postcondition that's separate from the code, too. I.e. in such cases, the postconditions separate the accidental and essential properties of a function, so they still have a role to play. Regards, Jo -- http://mail.python.org/mailman/listinfo/python-list