MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Design by Contracts in Mathematica

  • To: mathgroup at
  • Subject: [mg93216] Design by Contracts in Mathematica
  • From: ADL <alberto.dilullo at>
  • Date: Fri, 31 Oct 2008 03:07:18 -0500 (EST)

A question for the experts.

I have recently met the concept of Design by Contract (TM) software
implementation used in the language Eiffel. It is based on the
conditions "require", "ensure" and "invariant" which must be met by a
piece of code in order to be correctly executed. It appears that this
concept helps building reliable and reusable code.

Now, I find some analogies of the "require" clause with the normal
Mathematica patterns and Condition specifications for functions. In
any case, this condition appears to be easily implemented.

Instead, a Mathematica implementaion of "ensure" and "invariant",
which are triggered by the appearance of the final outcome of a
function, seem to me quite tricky to implement in a systematic way.

Now I come to my questions.

Do you think that a modification to the internal Mathematica cycle by
adding "exit" patterns to be matched by functions' outcomes (in
parallel with existing "inlet" patterns which must be matched before
transformations) could make easier Mathematica programming and

Do you think this would represent a big challenge for Wolfram

Thank you in advance for your comments.


  • Prev by Date: Re: Re: Re: Is there a way to make Mathematica commands and functions
  • Next by Date: Re: Re: 3D Graphics in a Palette or Dialog
  • Previous by thread: Graph by Date
  • Next by thread: Pure functions?