munificent / vigil

Vigil, the eternal morally vigilant programming language
2.9k stars 61 forks source link

What if the code of the "implore" is wrong ... #14

Closed jocelyn closed 10 years ago

jocelyn commented 11 years ago

I am used to contracts (i.e DbC Design By Contract) thanks to the Eiffel programming language ( http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29 )

The vigil approach is interesting, I am just wondering what if the code of an "implore" is not correct? Sometime code requires complex contracts, and it could happen that the developper (or even the specification) is wrong.

In that case, it might delete a lot of valid code. It would be better to just comment the code, and eventually add comment to explain why and where it was failing. Eventually with a kind of UUID , this way it the guilty code is fixed, one could just "uncomment" the related commented code. But maybe my vision is too gentle ;)

So far I still prefer the Eiffel approach, especially with the tools coming with EiffelStudio that allows autotesting the code and find error this way.

jvelilla commented 11 years ago

I agree with Jocelyn, I found the idea interesting but maybe its a little bit drastic, instead of delete the code, you could comment it, so then you could review the code of an implore, and the offending code, because the cause of the error could be in the specification ,and not in the code itself.

rowedonalde commented 11 years ago

The LORD giveth and the LORD taketh awaye--lo, if a function is punished, it was surely His plan. The LORD workes in mysterious wayes, sometimes in the folly keyestrokes of mortal men.

LeFreq commented 10 years ago

If the code following implore is incorrect, then the parent object should be punished, but vigil isn't capable of knowing whether high-level (i.e. programmer) logic is correct. Some other, later process would have to handle it once the problem shewn itself elsewhere.

munificent commented 10 years ago

I am just wondering what if the code of an "implore" is not correct?

The arguments to implore and swear are vows spoken directly into the sensitive ears of the vigil watchers. They are correct by definition. If you choose to lie to or mislead your own watchkeepers, then your fate is in your own hands.

It would be better to just comment the code, and eventually add comment to explain why and where it was failing.

Vigil prefers self-documenting code. The best way for incorrect code to document its own wrongness is to not exist.