From e60bf34e9833ee6bf020e0519651b4b0bf42012e Mon Sep 17 00:00:00 2001 From: jcguu95 Date: Thu, 16 May 2024 16:59:32 -0500 Subject: [PATCH 1/2] WSCL issue: VECTOR-PUSH-TYPE-ERROR --- wscl-issues/draft/vector-push-type-error | 73 ++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 wscl-issues/draft/vector-push-type-error diff --git a/wscl-issues/draft/vector-push-type-error b/wscl-issues/draft/vector-push-type-error new file mode 100644 index 00000000..ab181306 --- /dev/null +++ b/wscl-issues/draft/vector-push-type-error @@ -0,0 +1,73 @@ +Issue: VECTOR-PUSH-TYPE-ERROR +Forum: Cleanup +Category: CLARIFICATION +Status: draft +Edit History: 16-May-24, Version 1 by Jin-Cheng Guu +References: VECTOR-PUSH + +Problem Description: + + In the draft ANSI Common Lisp specification, the description of the + functions VECTOR-PUSH and VECTOR-PUSH-EXTEND indicates no exceptional + situations for when the NEW-ELEMENT is not of a type indicated by the + ELEMENT-TYPE of the VECTOR. + +Proposal (VECTOR-PUSH-TYPE-ERROR:SIGNAL-ERROR-IN-SAFE-CODE): + + This proposal changes the description of the VECTOR-PUSH function, so that + the section "Exceptional Situations" instead reads: + + "The functions VECTOR-PUSH and VECTOR-PUSH-EXTEND should signal an error of + type TYPE-ERROR if given a NEW-ELEMENT not of a type indicated by the + ELEMENT-TYPE of the VECTOR. + +Test Cases: + + (defun one () + (declare (optimize (safety 3))) + (vector-push 0 (make-array 5 :fill-pointer 2 + :element-type 'character + :initial-element #\a))) + + (one) => ERROR: The value 5 is not of type CHARACTER. + +Rationale: + + We think it was a simple omission from the draft ANSI specification to + indicate no exceptional situations. + +Current Practice: + + SBCL 2.4.1 + (one) => [signals type-error] + + ECL 23.9.9 + (one) => [signals simple-type-error] + +Cost to Implementors: + + Very small. We believe that most implementations are already signaling an + error in safe code. Some implementations may signal a simple error, and + those implementation would need to signal a type-error instead. + +Cost to Users: + + None. + +Cost of non-adoption: + + Application programmers may need to add numerous explicit checks to be + certain that their code is conforming. + +Benefits: + + Application programmers may rely on an error being signaled in safe code, + and thus avoid having to add explicit checks in portable code. + +Aesthetics: + + No influence. + +Discussion: + + N/A. From b127ec52897695ded3384497147389e0df6b3e18 Mon Sep 17 00:00:00 2001 From: jcguu95 Date: Sat, 25 May 2024 15:20:16 -0600 Subject: [PATCH 2/2] Change as yitzchak suggested. --- wscl-issues/draft/vector-push-type-error | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wscl-issues/draft/vector-push-type-error b/wscl-issues/draft/vector-push-type-error index ab181306..91c0baf4 100644 --- a/wscl-issues/draft/vector-push-type-error +++ b/wscl-issues/draft/vector-push-type-error @@ -29,7 +29,7 @@ Test Cases: :element-type 'character :initial-element #\a))) - (one) => ERROR: The value 5 is not of type CHARACTER. + (one) ; => [signals TYPE-ERROR with expected type CHARACTER] Rationale: