Vigil, the eternal morally vigilant programming language

Terry Reedy tjreedy at udel.edu
Tue Jan 8 09:12:21 CET 2013


On 1/7/2013 11:01 AM, Alain Ketterlin wrote:
>
> I just came across Vigil, an extension to python for serious software
> engineers,

I hope that last part comes from a sense of humor.

> at https://github.com/munificent/vigil and thought everybody
> in this group would be interested (sorry if it has been announced
> before).
>
>  From README:
>
> | Vigil is a very safe programming language, and an entry in the January
> | 2013 PLT Games competition.
> |
> | Many programming languages claim to take testing, contracts and safety
> | seriously, but only Vigil is truly vigilant about not allowing code
> | that fails to pass programmatic specifications.

While the language is a joke (Procrustes would be a somewhat better 
name), the example illustrates the near uselessness of contract 
checking, at least for functions. The example fib(n) function 'swears' 
that the answer is a count (not negative). Ha, ha, very funny. A simple 
'return 0' would satisfy that useless contract*. A correct fib(n) 
function must actually calculate fib(n), and in practice, that is not 
possible to check. Even checking that sorted(iterable) is correct 
(outside a test situation) is harder than it might first seem#.

* In any of the many languages that use biased residue classes as a 
substitute for real integers, positive + positive = positive is not so 
trivial. So the function must return a negative to signal bad input or 
raise an exception either directly or by an input condition. The 
advantage of the directly exception is that the exception message can be 
tailored to the audience and situation. [Vigil would simply excise the 
calling function.]

# Given sorted(iterable) where iterable gets some number of comparable 
items from stdin, how is the contract checker to determine that the 
output is indeed a permutation of the unmutated input items, before 
checking that they are are actually sorted.

-- 
Terry Jan Reedy




More information about the Python-list mailing list