Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I laughed when I saw this: "If your function crashes upon error, you should append OrDie to the function name.", and then as an example: "OpenFileOrDie". Lol.


I thought it was an old perl convention.

    do_something or die "Somebody set up us the bomb"


What if that was an actual semantic transformation in the language? Naming something XorDie would execute the body of X in a context within which all errors are caught, and if any is found, the call returns NIL or similar?

Easily doable with handler-case, unwind-protect and reader macros, but ugly as sin.


We do the same thing with getX and setX; it would be interesting to see more "meaningful" function names in a language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: