Archived

This forum has been archived. Please start a new discussion on GitHub.

Why not add DBC feature to Slice?

Recently, Design by Contract has been accepted by many develop,
Slice,as a new approch, why not add the important feature ?:)

Comments

  • Can you elaborate on this please? What exactly should Ice support? "Design by Contract" is just a buzz word, and can mean lots and lots of things...
  • For instance, to add some attribute description can enhance the interface signature which support the pre-condition(Require), post-condition(Ensure) or the invariant ... When ice generate the cpp/head files, it also generate the assert conditions. So it can reduce many trivial coding works and make the code more consistant:)
  • Hmm... given that in many cases object state is not expressed in Slice, I'm not sure how this can work. What would for example invariants test, if an Ice object is only defined by an interface, but not by a class with data members?

    I guess what Slice could do is to add range check for parameters, i.e. a limited form of pre- and post-conditions. But this would require a much more sophisticated expression evaluator in Slice, especially when it comes to complex data types (e.g., checking for certain values or ranges in a sequence element, which is a member of a struct, which is contained in a dictionary).

    This could become complicated very quickly, so that in the end Slice is not a specification language anymore, but a rather an implementation language.