Hacker News new | ask | show | jobs
by brvs 4260 days ago
I would love it if instead of quitting my program with an error, it just went ahead and called the method it thinks I'm referring to. This would remove a lot of unneeded friction from web development.
12 comments

Baaad idea, hides the errors and you have no idea if it will call the correct thing in the future too.
Agreed with this.
You should implement a `yolo` gem to support this.
Welp, next april fools day gem idea reserved!
One of the early PL/1 compilers IBM wrote in the 60's did something akin to this. It was a 'premium' feature, available in one of the more expensive compilers. Where it detected any error or wrong looking code, it would correct it. There's a story floating around somewhere on the net of one guy trying to use it... (Which I can't find at the moment.)

The first time he tried to compile with it, he used a program of roughly "Hello from PL/1". When he ran it, he got a division by zero error, because his string had been turned into an arithmetic expression. With the 1 turned into an I, which was then an unitialized variable, which then defaulted to 0.

The person taking over your projects when you move on would put a bounty on your head if you were to do that.
Haha, loving the description :)
There is actually a python module that does something like that. It goes to the extreme to keep the program running no matter the error you make, arithmetic error are replaced with random results, missing functions skipped, exceptions silently swallowed etc etc. It is obviously a joke but they could benefit greatly from this feature ;)
For those who are interested, I'm pretty sure this is what you're referring to https://github.com/ajalt/fuckitpy. It's worth looking into for the documentation alone.
YES! Thank you

    FuckIt.py uses state-of-the-art technology to make sure your Python 
    code runs whether it has any right to or not. Some code has an error? Fuck it.

    FuckIt.py uses a combination of dynamic compilation, Abstract Syntax Tree 
    rewriting, live call stack modification, and love to get rid of all those 
    pesky errors that make programming so hard.

    Still getting errors? Chain fuckit calls. This module is like violence: 
    if it doesn't work, you just need more of it.
Sounds like the Python equivalent of Visual BASIC's "On Error Resume Next" atrocity.

Except you can find "On Error Resume Next" in "production" code. If I ever consider taking contracts doing Visual Basic, the contract will specify that any occurrence of "On Error Resume Next" automatically doubles my daily rate.

That has been tried before. Results were... poor.

http://www.catb.org/~esr/jargon/html/D/DWIM.html

You are correct, but please don't refer to the bastardized version of the Jargon file. Wikipedia has a much better and more accurate article, with actual quotes and citations instead of unsourced politically motivated mythology attributed to "some victims":

https://en.wikipedia.org/wiki/DWIM

>Critics of DWIM claimed that it was "tuned to the particular typing mistakes to which Teitelman was prone, and no others" and called it "Do What Teitelman Means" or "Do What Interlisp Means." - Guy L. Steele Jr., Richard P. Gabriel, "The Evolution of Lisp"

The person who bastardized and maintains the Jargon file is a racist, sexist nut job who built his career on attacking the Free Software movement, and who doesn't deserves anyone's respect or attention: http://rationalwiki.org/wiki/Eric_S._Raymond

That... makes me very sad. I remember the old ESR. Knew that I hadn't heard of him in a long time, did not know he went a bit nutty...
So, you want programming to be more like writing html in the Quirks Era
I'm pretty sure this line of thinking led to us having horribly misguided features like ASI (automatic semicolon insertion) in javascript today
Except for in for loops semicolons don't really do anything though. The job of the semicolon could easily be replaced by just a white space character.
This gem does just that:

https://github.com/markburns/fuzzy

Ah, the mentality of the web: "I don't have time to get it right, just keep spewing code!"
That would be hideously bad