The OK Function
by Jiang on May.04, 2009, under Computing
I encountered a most awesome function today; it’s called OK.
OK accepts no arguments and returns either true or false. When a program needs to make a decision, it could ask if it’s OK or not. Interesting? You bet. But this is only half of the story. How does OK work?
When OK is called, it saves a snapshot of the current program execution state and returns true; it also installs a hook so that it is called at the end of the program. If the program ends successfully, OK does nothing. If the program fails, on the other hand, OK recalls the saved state and returns false.
Hmm…
Popularity: 1%
September 9th, 2009 on 6:00 pm
You’re the fourth result on a google search for “ok function”
September 9th, 2009 on 6:45 pm
and what languages implement OK?
September 9th, 2009 on 11:04 pm
Hm… there are better languages for this, but: http://www.110mb.com/forum/-t45974.0.html