Re: Adding practical (runtime) facts to a program



"Design by Contract" also lets you assert a variable's max/min bounds
at the entry/exit points of a block of code. Besides such extreme
conditions, we can also specify "what range of value this variable
OFTEN falls into?"

yaoziyuan@xxxxxxxxx wrote:
Traditionally, the compiler and the debugger are researched and
developed separately. I think the programmer could add information
about a program's practical requirements to the source code of this
program (or the debugger could also automatically collect such
information from test runs), and such information would be useful for
the compiler to further optimize the binary code (e.g. translate a
"for" loop according to its practical runtime loop count) and for
program verifiers to find potential logical problems (e.g. boundary
check).

Such information could also give other programmers an understanding of
the magnitude of input data the program can handle, etc.

What do you think of this?

Yao Ziyuan

.