Why exactly is the verb "to throw" used when an error occurs in the program?
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay
--
Chapters
00:00 Why Exactly Is The Verb &Quot;To Throw&Quot; Used When An Error Occurs In The Program?
00:18 Accepted Answer Score 6
00:58 Answer 2 Score 2
01:49 Answer 3 Score 8
03:03 Answer 4 Score 6
03:31 Thank you
--
Full question
https://english.stackexchange.com/questi...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#expressions #programming #computing
#avk47
ANSWER 1
Score 8
The concept of exceptions originated in the programming language Lisp. Originally, a part of a program might cause an error to occur. You could specify a way for the program to continue executing on an error — in modern terminology, a way to handle the error. Then a mechanism was added to signal an error, i.e. to artificially cause an error condition, which allowed programmers to make use of the error handling mechanism for things that were not errors. This history is described in “A Pattern of Language Evolution” by Richard P. Gabriel and Guy L. Steele Jr..
The terms throw and catch appeared in 1972 in MACLISP. One of the first published work including those terms was the 1974 MACLISP Reference Manual by David A. Moon (§5.3 p.43). The mechanism is described as non-local exit. This means “jumping” from one point of the program to another, which generalizes what happens when an error occurs. The word exception was not used yet in the software community at the time. You didn't “throw an error” or “throw an exception” back then, you threw a value from one part of the program (the throw
instruction) to another (the catch
instruction), together with a tag indicating where to throw it to. Exceptions later evolved as a data structure combining the tag and the value.
ACCEPTED ANSWER
Score 6
see: https://en.wikipedia.org/wiki/Exception_handling at History
"... Software exception handling developed in Lisp in the 1960s and 1970s. This originated in LISP 1.5 (1962), where exceptions were caught by the ERRSET keyword, which returned NIL in case of an error, instead of terminating the program or entering the debugger.[10] Error raising was introduced in MacLisp in the late 1960s via the ERR keyword.[10] This was rapidly used not only for error raising, but for non-local control flow, and thus was augmented by two new keywords, CATCH and THROW (MacLisp June 1972), reserving ERRSET and ERR for error handling. ..."
ANSWER 3
Score 6
An attestation of "threw an error" on page 663 of The Electrical World and Engineer. New York, 1900.
And here's one of "throws an error": on page 323 of Productive Dairying. Philadelphia, 1917.
And here's one of "throws errors": on unknown page (thanks, Google) of Techniques of Plant Maintenance and Engineering. Madison Wisconsin, 1950.
ANSWER 4
Score 2
This is a term specific to programming. Exceptions are 'thrown' which are 'caught' most often by an execution component. This shows the relationship between the exception, which is the initial event in the interaction, and the execution, which is a response event.
Quote from the Wikipedia article on Exception Handling:
"Software exception handling and the support provided by software tools differs somewhat from what is understood under exception in hardware, but similar concepts are involved. In programming language mechanisms for exception handling, the term exception is typically used in a specific sense to denote a data structure storing information about an exceptional condition. One mechanism to transfer control, or raise an exception, is known as a throw. The exception is said to be thrown. Execution is transferred to a "catch"."