[m-dev.] tightening up require_complete_switch
novalazy at gmail.com
Mon Apr 11 11:31:06 AEST 2016
I recently found a bug in my code where the named variable was not
actually the subject of the switch:
Obj = foo, ...
Obj = bar, ...
In real code the problem may not be as readily apparent, but the
require_complete_switch gives a false sense of security.
Another problem that occurs is where the subgoal is not actually a
switch so the compiler does nothing with it.
require_complete_switch was designed to cope with multi-moded code, but
most code is not multi-moded. Perhaps require_complete_switch can be
more strict in single-moded clauses, i.e. it would report an error
unless the sub-goal is a complete switch on the named variable?
Or simply remove the subtlety in require_complete_switch even if
that means require_complete_switch could no longer be used in some
If require_complete_switch were stricter, the VAR part could be made
optional as well.
More information about the developers