6 ms·
To make this actually useful, instead of deleting bad functions, it's probably better to make the offending functions throw a special exception when they are ca
by ArchD 14y ago
To make this actually useful, instead of deleting bad functions, it's probably better to make the offending functions throw a special exception when they are called, signaling the calling of a function known to be bad. This way, you can still inspect the code for the offending functions and fix the bugs.
Otherwise, the original code could just totally disappear after multiple runs. What good is non-buggy code if it does nothing? Failure to perform the user's requirement at all is also a bug. Not having the original code that you can at least edit to fix is rather pointless, especially when vigil doesn't indicate the callers of the offending functions, because next time you run vigil, those will get deleted. Besides, if foo()'s failure is completely due to bar()'s failure to fulfill its 'swear', it's foo()'s failure is not really its bug.
- mcguire 14y agoAnd so moral relativism raises its hideous, three-horned, leering head....
- eli_gottlieb 14y agoAnd now I'm imagining Moral Relativism speaking in John de Lancie's voice.
- ConstantineXVI 14y agoHow will functions learn to stay in line if the compiler doesn't make an example every now and then? On a serious note, what you're thinking of is contracts, like so[0] [0] http://disnetdev.com/contracts.coffee/ http://disnetdev.com/contracts.coffee/
- phpnode 14y agoprojects like this are why coffeescript needs to support macros. There are so many coffeescript dialects out there that make minor changes to the language to accomodate one or two extra features, e.g. IcedCoffee. I don't want to have to use a separate, presumably less well supported language for this kind of stuff, just let me plug it in!
- ConstantineXVI 14y ago> The golden rule of CoffeeScript is: "It's just JavaScript"[0] Macros would be deviating from core JS too much to fit with CoffeeScript's goal. Just happens that the compiler is nicely hackable to allow for these projects. Not to say I object to the idea of an expanded CoffeeScript, just that it should be a fork. [0] http://coffeescript.org/ http://coffeescript.org/
- gtrak 14y agoMacros will eventually be in core JS, see: http://disnetdev.com/blog/2012/10/14/hygienic-macros-for-javascript/ http://disnetdev.com/blog/2012/10/14/hygienic-macros-for-jav... and http://brendaneich.github.com/Strange-Loop-2012/#/40 http://brendaneich.github.com/Strange-Loop-2012/#/40 http://www.infoq.com/presentations/State-JavaScript http://www.infoq.com/presentations/State-JavaScript
- busted 14y ago> make the offending functions throw a special exception when they are called, signaling the calling of a function known to be bad. I believe this would make it no different from an 'assert'.
- andreasvc 14y agoYes it could throw a special exception. We could call this exception AssertionError ... wait a minute!
- aredington 14y agoFrom the creator's own mouth, it's a satire language, but all satire has a good point. Vigil's is many programmers' susceptibility to The Broken Window problem. It's creation raises a good point about the usefulness of contracts in the absence of mechanisms for enforcing those contracts.
- discreteevent 14y agoI just read it as a satire on how ridiculous safety checking could be if taken to an extreme. In the same way that some dynamic language advocates think its hilarious that statically typed languages won't even let you run your program if there is a type error in case you might harm yourself by violating your own rules!
- dkarl 14y agoBah. A virtuous function values its integrity over its life. It will speak the truth, and if that means throwing an exception that the caller isn't prepared to hear, so be it. Bring on the hemlock!