munificent / vigil

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

Punishing main #22

Open AfonsoFGarcia opened 10 years ago

AfonsoFGarcia commented 10 years ago

After modifying the swear example to make sure that every single function would be deleted, I was faced with the problem that vigil doesn't want to punish the main function. If the main function happens to call functions that were deleted, the main function is a bad girl and must be punished! Instead, this is what happens:

uncaught error from line  4
Traceback (most recent call last):
  File "./vigil", line 94, in <module>
    exec(source)
  File "<string>", line 10, in <module>
  File "./vigil", line 76, in vigil_uncaught
    punish(raise_line, "Raised '%s' which was not caught." % sys.exc_info()[1])
  File "./vigil", line 36, in punish
    source_lines[i] = ''
IndexError: list assignment index out of range

Here is what's on the source file after vigil has punished everything into oblivion.

# This shows what happens when a function fails to keep its oath.

def main():
    innocent_fn()
    innocent_fn()

How can we consider vigil the Batman of programming languages when main is above them all? Justice must be blind and applied to everybody!