4 ms·
On Error Resume Next is similar to NaN. In some situations the code can be much simpler if after a lengthy calculation one just test for an error result with no
by fpoling 5y ago
On Error Resume Next is similar to NaN. In some situations the code can be much simpler if after a lengthy calculation one just test for an error result with no error checks in between. In modern languages that evolved into various forms of Maybe/Optional types with various syntax sugar like ?. or Haskel do notation.
- saithound 5y agoIt's disingenuous to suggest that "on error resume next" evolved into, or even influenced, Maybe/Optional types. The "on error" construct existed in QuickBasic, but it took a goto line number or label as its operand. "ON ERROR RESUME n" would give you a relative line, allowing you to jump n lines down. Since Visual Basic didn't care about line numbers, "on error" took a goto label instead. Visual Basic 3.0 introduced the "on error resume next" construct in 1993 so that the QuickBasic usage could be imitated. Meanwhile, already Haskell had Maybe/Option types and monadic notation in 1992.