Map
Index
Random
Help
Topics
th

Topic: failure returning functions and expressions

topics > computer science > programming > Group: exception handling



Group:
expression evaluation

Topic:
backtracking
Topic:
boolean values, binary numbers, and bit strings
Topic:
conditional statement
Topic:
control returning functions and expressions
Topic:
exception handling by termination
Topic:
exception handling by unique value
Topic:
functional side effects
Topic:
exception handling by try..catch

Summary

A function or expression can report an exception by returning "fail". The failure may be testing at the function call, or propagated through an expression.

IEEE floating point includes a NaN value to indicate failures. Limbo calls can return a tuple that includes an error return. If an error is deemed unlikely, the programmer may skip the failure test. If so, an exception can damage data structures or remain undetected. (cbb 4/98)

Subtopic: failure returns up

Quote: use '(a, b)' for a tuple or pair of values; used for multiple return values, error returns, simple data structures [»dorwSM1_1997]

Subtopic: continuation after failure up

Quote: a successful Smalltalk primitive exits the method; otherwise evaluate the remaining expressions [»xlrg8_1981]
Quote: in Icon, tab (10|5) == tab(10)|tab(5) because a failure of tab(10) invokes the alternative value [»grisRE4_1980]

Subtopic: floating point arithmetic up

Quote: SANE is a thorough implementation of IEEE Standard 754 for binary floating-point arithmetic [»appl_1988]

Subtopic: conditional control up

QuoteRef: farbDJ1_1964 ;;26 gotos by /(label) f(label) s(label) for always, failure, success
Quote: C's && and || operators guarantee left-to-right, short-circuit evaluation; their predictable behavior is frequently used [»ritcDM7_1978c]

Subtopic: failure returning functions and expressions up

Quote: the try-parse pattern reports failure instead of an exception; avoids performance problem for a common scenario [»cwalK_2006]
Quote: any function may return failure, e.g., if an exception is not caught [»liskBH11_1979]
Quote: in CLU, an exception is as efficient as a normal return; use exceptions to distinguish multiple returns [»liskB_1996]
Quote: a CLU procedure can either return or signal an exceptional condition; both can provide result objects
Quote: an Aleph predicate or question may fail
QuoteRef: storEF_1970 ;;25 true procedure returns arguments, false procedure keeps arguments as the same
QuoteRef: storEF_1970 ;;25 false (statement is false), return (procedure is true), returnf (procedure is false)
QuoteRef: storEF_1970 ;;28 all statements true of false eg open a file is true if successful
QuoteRef: boscR9_1973 ;;7 if rule fails, parameters are not passed back
QuoteRef: sammJE_1969 ;;401 subroutine call with specific fail exit eg (fail label, do, name) then in routine have FAIL and DONE
QuoteRef: lechR_1973 ;;174 the value of a program (a graph of nodes) is true or false
QuoteRef: martMJ_1974 ;;668 an expression group of statements can return succeed, fail or value for a case control statement
Quote: Vmalloc uses Return-Proceed-Retry for event handling; the sign of the return indicates the desired action [»voKP2_2000]

Subtopic: problems with failure return up

Quote: problems with error handling by return code and status flags; checked at call sites; harder to read; multiple error cases ignored; harder to modify; expands set of legal values [»buhrPA9_2000]
Quote: exceptions promote API consistency; designed for failure reporting and nothing else; while return values have many uses, e.g., Win32 API [»cwalK_2006]
Quote: object-oriented frameworks can not standardize on return-value-based error reporting [»cwalK_2006]
Quote: if using return values, error handling code must be near the code that could fail [»cwalK_2006]
Quote: error codes are often ignored; exceptions are impossible to ignore, improving robustness
[»cwalK_2006]

Related Topics up

Group: expression evaluation   (5 topics, 97 quotes)

Topic: backtracking (30 items)
Topic: boolean values, binary numbers, and bit strings (44 items)
Topic: conditional statement (8 items)
Topic: control returning functions and expressions (6 items)
Topic: exception handling by termination (16 items)
Topic: exception handling by unique value (8 items)
Topic: functional side effects (11 items)
Topic: exception handling by try..catch
(53 items)


Updated barberCB 6/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.