munificent / vigil

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

What about fib(-3) ? #2

Open 6502 opened 11 years ago

6502 commented 11 years ago

I called fib(-3) and I didn't do anything bad doing that. Now I think the only way out is to remove fib from readme, correct? And what about references to swear for which now no examples are provided?

May be it's easier if you just wipe this whole repository off...

munificent commented 11 years ago

Fortunately, the README is not a valid Vigil program, so Vigil makes no claims to oversee it.

Reconcyl commented 7 years ago

Vigil does not handle functions that go into an infinite loop. Doing so would require solving the halting problem, thereby proving that complete supreme moral vigilance is impossible.

refi64 commented 7 years ago

TBH it would be cool if Vigil just waited like 5 seconds, sent a SIGINT, and used the resulting KeyboardInterrupt traceback to delete the lowest function.

danShumway commented 7 years ago

I'm not completely sure I see what the problem is. An infinite loop hasn't finished running yet, so Vigil is simply waiting to see if the oath is fulfilled. It would be improper to prematurely punish a crime; it would be like deleting a function before it ran.

Besides, there's no such thing as a truly infinite loop. Eventually our sun will go supernova, at which point the offending code will be removed.

refi64 commented 7 years ago

Yeah, but isn't procrastination evil?

danShumway commented 7 years ago

I don't think it is, but maybe I'm just going soft.

Actually, thinking about what you said above, what springs to my mind as evil would be a user interrupting a function before it finished. It speaks to me of a kind of a lack of commitment, or at least some kind of cowardice; are you afraid of what it might return?

Maybe there's a way to kill two birds with one stone here, although I'm not completely sure how technically feasible this would be to implement. A user could run a function and Vigil would never prematurely punish it. BUT, the user would need to commit to running the function all the way through, otherwise Vigil would take it as a sign that the function/user were colluding to hide corruption.

That way Vigil doesn't prematurely punish code, but will punish code that's slow enough to warrant a user interrupting the process. Again, not sure what Vigil's capabilities are for catching interrupts, but if it's possible for Vigil to catch a user-interrupt, maybe it could punish the wayward function at that point?

So you're perfectly free to run code that contains an infinite loop as long as you NEVER interrupt it or kill the process. Do you think that would be enough of a consequence for inefficient code?

o0Ignition0o commented 6 years ago

Have you considered punishing the user interrupting the process ?

And thou shall trust the seeer