This is mostly related to the discussion that took place on page 2 of this thread:

http://forum.dlang.org/thread/[email protected]?page=2

The issue (as I see it), is that the "contract blocks" in/out, are meant to verify the data that is passed to and from the function, rather than verify the implementation of said function.

The problem is that it's "conditional execution" is tied to the release mode of the compiled function, as opposed to the release mode of the caller's code.

This means that if you are using somebody else's lib, his code will gladly accept your erroneous data, and crash, with no warning to you.

An obvious example would be the (theoretical) sqrt methods, that could restrict via "in" that the input is positive: Once they are written and fully verified, they are compiled and released in release mode. But that doen't mean somebody using it in his new code won't accidently call it with a negative number... and sqrt will fail to see it.

--------
I'd like to request (but I don't know how feasable this is), that "in/out" blocks be made part of the public interface of a function, and that it be compiled by the *caller* code (according to his flags), and *not* the function itself.

Reply via email to