On 10/25/2011 12:48 AM, Alexey Veselovsky wrote:
Hm... It is possible to split this single file to specification and
implementation part (in single file, not split to 2 different files)?
Like in Haskell for example or Object Pascal.
You could maybe put contracts on interface methods and then implement those
interfaces (even from different source files). But DbC has not gotten too
much attention from the compiler developers lately, so I think there might
be some unresolved bugs in DbC.
Yep. Looks like in D only one way for real modularity: emulate it via
OOP (like in c++ or java, where all is object (yes, I know, in C++ not
all is object, but in C++ module is emulated via classes and
objects)).
Eventually it should be possible to put contracts on free function
declarations (with the current language version, it only works for
function definitions). But I am sure that OOP is not the only way to get
real modularity in D. Given it's compile-time capabilities it is
probably already possible to implement some ad-hoc system to allow for
nice modular specification driven development. The language is pretty
flexible. What would be the ideal set of features to support modularity
in your opinion?