On Mon, 03 Aug 2009 11:47:49 -0400, Don <nos...@nospam.com> wrote:
Michiel Helvensteijn wrote:
Don wrote:
It would be strange to put outer function statements before the
precondition, but that's true of any inner function.
I don't see it as an inner function, but as a part of the public
interface.
It's an enforceable documentation of the function.
I agree, except that I don't see any reason why a special inner function
cannot be part of the public interface. I don't think it makes any
difference where it is appears in the code.
In my experience, most of the code in the precondition frequently gets
duplicated in the function itself. But that's secondary -- I just want
to get rid of 'body'.
The stronger argument against the 'inner function' syntax is the case
when you have an interface, which naturally has no body, but still has
an 'in' contract. Where does the contract go?
I refuse to believe that the optimal solution to that problem involves
the 'body' keyword.
Don't template constraints have a similar syntax, but no body keyword?
Why can't that be the same for preconditions?
-Steve