1 R7RS small errors in the C system
Daphne Preston-Kendal edited this page 2023-11-22 09:34:43 +00:00

This page is Daphne Preston-Kendal’s attempt to guess roughly what each ‘is an error’ case in R7RS small would correspond to in the C specification system of undefined/unspecified/implementation-defined behaviour. Note that the assignments here are made in terms of what she personally thinks would have been reasonable for a language like the small language, not an attempt to define what these cases should do in the large language. In other words, there is a lot of ‘undefined’ here, which will be tightened up for the large language (in particular, probably by applying something like the R6RS ‘safety’ guarantee).

Based on John Cowan’s ItIsAnError wiki page.

1.3.2 procedure domain errors [domain]
undefined
1.3.2 too many or too few arguments [mismatch]
undefined
1.3.3. reuse of auxiliary syntax [syntax]
implementation-defined
1.3.3. violation of start-end constraints [domain]
undefined
2.4 non-numeric datum labels [read]
unspecified whether a lexical violation (‘read error’) or some datum will be read
2.4 forward references in datum labels [read]
unspecified whether a lexical violation or if forward references will be resolved
2.4 recursion in datum labels [read]
undefined
2.4 circular code [syntax]
undefined — pretty much impossible to reliably detect this and signal an error
3.4 violations of immutability [immutable]
unspecified whether an error will be signalled or the mutation will work
4.1.1 references to undefined variables [undefined]
undefined
4.1.3 () as code [syntax]
either undefined, or unspecified whether it evaluates to the empty list or raises an syntax violation
4.1.4. repeated variables in lambda lists [syntax]
undefined
4.1.6 set! of unbound variable [undefined]
undefined
4.2.1 => in cond or case doesn't accept one argument [domain]
undefined by extension of 1.3.2
4.2.1 duplicated case keys [syntax]
unspecified whether a syntax violation, or whether one of the clauses with the key will be chosen
4.2.2 repeated variables in let, letrec, let-values, let-values* lists or equivalent internal variable definitions [syntax]
undefined by extension of 4.1.4
4.2.2 direct recursion in letrec or letrec* or equivalent internal variable definitions [syntax]
undefined
4.2.2 mismatch between let-values formals and returned values [mismatch]
undefined by extension of 1.3.2
4.2.4 repeated variables in do [syntax]
undefined by extension of 4.1.4
4.2.6 non-parameter in parameterize [domain]
undefined
4.2.8 unquote-splicing of a non-list [domain]
undefined
4.2.9 uncaught case in case-lambda [mismatch]
undefined by extension of 1.3.2
4.3.1 repeated keywords in let-syntax [syntax]
undefined arguably by extension of 4.1.4
4.3.2 non-identifiers in syntax-rules [syntax]
undefined
4.3.2 repeated pattern variable in syntax-rules [syntax]
undefined by extension of 1.3.2
4.3.2 unhandled syntax in syntax-rules [syntax]
should honestly be a straight-up syntax violation
4.3.2 unreconstructible syntax-rules output [syntax]
implementation-defined whether a syntax violation or some extension of the rules is allowed
5.2 unknown identifiers in only, except, rename import specs [syntax]
undefined
5.2 importing an identifier more than once with different bindings [syntax]
unspecified whether an error will be signalled, or one of the identifiers’ bindings will be used
5.2 redefining or mutating imported bindings [syntax]
undefined
5.2 referring to unimported identifiers [syntax]
undefined by extension of 4.1.1
5.3.3 duplicate variables in define-values [syntax]
undefined by extension of 4.1.4
5.4 use of a syntax keyword before its definition [syntax]
unspecified whether syntax violation or will work as expected
5.4 hopelessly muddled or ambiguous definitions [syntax]
undefined
5.5 duplicate field names in records [syntax]
undefined by extension of 4.1.4. (actually this should not be an error at all in my view)
5.5 undefined field name in record constructor [syntax]
undefined
5.5 invoke record accessor or mutator on record of wrong type [domain]
undefined by extension of 1.3.2
6.2.3 use anything but an exact integer as a container index [domain]
unspecified whether inexacts are coerced to exacts or an error is signaled; in other cases, undefined by extension of 1.3.2
6.2.6 division by exact 0 [domain]
unspecified whether an error is signalled, or an exact infinity is returned
6.2.7 unusual conversion radix [domain]
for <10, unspecified whether it will work or not; otherwise undefined by extension of 1.3.2
6.2.7 impossible conversion from number to string [domain]
undefined by extension of 1.3.2
6.4 car or cdr of non-list [domain]
undefined by extension of 1.3.2
6.4 list-ref, list-set!, list-tail invalid index [domain]
undefined by extension of 1.3.2
6.4 alist is not an alist [domain]
undefined by extension of 1.3.2
6.4 attempt to copy a circular list [domain]
undefined by extension of 1.3.2
6.5 mutating symbol names [immutable]
undefined
6.7 violate forbidden-character restrictions [domain]
implementation-defined which characters are forbidden
6.7 string-ref, string-set! invalid index [domain]
undefined by extension of 1.3.3
6.7 attempt to convert non-character to string or to fill string with non-character [domain]
undefined by extension of 1.3.2
6.7 violate string-copy! restrictions [domain]
undefined by extension of 1.3.3
6.8 vector-ref, vector-set! invalid index [domain]
undefined by extension of 1.3.3
6.8 violate vector-copy! restrictions [domain]
undefined by extension of 1.3.3
6.9 bytevector-u8-ref, byte-vector-u8-set! invalid index [domain]
undefined by extension of 1.3.3
6.9 violate bytevector-copy! restrictions [domain]
undefined by extension of 1.3.3
6.9 invalid UTF-8 byte sequences in utf8->string [domain]
undefined
6.10 mapping procedures must accept as many containers as are available [domain]
undefined by extension of 1.3.2
6.10 lists being mapped must not all be circular [domain]
undefined
6.10 mapping procedures must not mutate inputs [immutable]
undefined
6.10 call/cc must accept one argument [domain]
undefined by extension of 1.3.2
6.10 with-exception-handler handler and thunk arguments must accept a condition object and no arguments respectively [domain]
undefined by extension of 1.3.2
6.11 attempt to continue from a non-continuable exception [non-continuable]
undefined
6.13.1 procedure passed to a call procedure must accept one argument [domain]
undefined by extension of 1.3.2
6.13.1 trying to get a string or bytevector out of a port that is not a string or bytevector port [domain]
undefined
6.13.2 attempt operations on a closed port [closed]
undefined
6.14 file names must be strings [file]
undefined
6.14 attempt to mutate command-line strings [immutable]
undefined
6.14 indecipherable environment variable [domain]
undefined
6.14 attempt to mutate environment variables or values or features [immutable]
undefined
7.1 identifier starting with a combining character [read]
unspecified whether a lexical violation or simply allowed