Implementing Design by Contract using GOTO and R(unTime)FE

BLS nanali at nospam-wanadoo.fr
Tue Jun 12 06:04:11 PDT 2007


Hi,
what I want to do is to implement Design by Contract only by using 
*goto* and RTFE  (RunTime Function Evaluation)


You may wonder why.
Short answere is that I am writing a book about OOP in Windev; and DBC 
should be part of the documentation.

Windev s GOTO features are similar to D s.
CTFE is not available instead R(untime)TFE, because the Windev compiler 
is part of a DLL you have to deploy anyway.

Just an example :
procedure x(parameter is int)
   toCompile is string
   toCompile = "r is bool;if parameter > 10 then r = false else r = 
true;return r"
Compile("DummyFunction", toCompile")
// Dummufuntion is a /virtual function/ i mean not comparable to D CTFE 
//Some Windev internals not relevant to understand the code...
IF DummyFunction() then
   GOTO label1
ELSE
   GOTO label2
END

Do you think that I can, based on these 2 language constructs, implement 
something similar to DBC ??

Many thanks in advance , (and sorry for beeing Off Topic)
Bjoern




More information about the Digitalmars-d-learn mailing list