From 9fdaa7ca0289937ac648d6c81aa68a90790cc203 Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Wed, 17 Oct 1990 03:50:32 +0000 Subject: [PATCH] Added the REQUIRED-ARGUMENT function for squelching type warnings about required keyword argument defaults. --- code/extensions.lisp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/code/extensions.lisp b/code/extensions.lisp index 857414ebd..1274319f9 100644 --- a/code/extensions.lisp +++ b/code/extensions.lisp @@ -17,7 +17,8 @@ (export '(letf* letf dovector deletef indenting-further file-comment read-char-no-edit listen-skip-whitespace concat-pnames iterate once-only collect do-anonymous undefined-value - define-hash-cache defun-cached cache-hash-eq)) + required-argument define-hash-cache defun-cached + cache-hash-eq)) (import 'lisp::whitespace-char-p) @@ -31,6 +32,19 @@ (defun undefined-value () '%undefined%) +;;; REQUIRED-ARGUMENT -- Public +;;; +(proclaim '(ftype (function () nil) required-argument)) +(defun required-argument () + "This function can be used as the default value for keyword arguments that + must be always be supplied. Since it is known by the compiler to never + return, it will avoid any compile-time type warnings that would result from a + default value inconsistent with the declared type. When this function is + called, it signals an error indicating that a required keyword argument was + not supplied. This function is also useful for DEFSTRUCT slot defaults + corresponding to required arguments." + (error "A required keyword argument was not supplied.")) + ;;; FILE-COMMENT -- Public ;;; -- GitLab