X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-extensions.lisp;h=857e0a028433af713d4113de6123828b28ecbabf;hb=2abf77f6c4c559a3e5b7fc351a4743305381feb6;hp=9642a5f3782697be7441bbab54795f218edc423b;hpb=6f408b4ce6a2f411618fe1bebf63ee08093a7d03;p=sbcl.git diff --git a/src/code/early-extensions.lisp b/src/code/early-extensions.lisp index 9642a5f..857e0a0 100644 --- a/src/code/early-extensions.lisp +++ b/src/code/early-extensions.lisp @@ -18,8 +18,8 @@ (in-package "SB!EXT") -(file-comment - "$Header$") +;;; something not EQ to anything we might legitimately READ +(defparameter *eof-object* (make-symbol "EOF-OBJECT")) ;;; a type used for indexing into arrays, and for related quantities ;;; like lengths of lists @@ -58,20 +58,6 @@ (defconstant escape-char-code 27) (defconstant rubout-char-code 127) -;;; Concatenate together the names of some strings and symbols, -;;; producing a symbol in the current package. -(eval-when (:compile-toplevel :load-toplevel :execute) - (declaim (ftype (function (&rest (or string symbol)) symbol) symbolicate)) - (defun symbolicate (&rest things) - (values (intern (apply #'concatenate - 'string - (mapcar #'string things)))))) - -;;; like SYMBOLICATE, but producing keywords -(defun keywordicate (&rest things) - (let ((*package* *keyword-package*)) - (apply #'symbolicate things))) - ;;;; miscellaneous iteration extensions (defmacro dovector ((elt vector &optional result) &rest forms) @@ -179,7 +165,7 @@ (let ((n 0)) (dolist (arg args) (unless (= (length arg) 2) - (error "bad arg spec: ~S" arg)) + (error "bad argument spec: ~S" arg)) (let ((arg-name (first arg)) (test (second arg))) (arg-vars arg-name) @@ -360,6 +346,27 @@ (declaim (ftype (function (index) list) make-gensym-list)) (defun make-gensym-list (n) (loop repeat n collect (gensym))) + +;;; ANSI guarantees that some symbols are self-evaluating. This +;;; function is to be called just before a change which would affect +;;; that. (We don't absolutely have to call this function before such +;;; changes, since such changes are given as undefined behavior. In +;;; particular, we don't if the runtime cost would be annoying. But +;;; otherwise it's nice to do so.) +(defun about-to-modify (symbol) + (declare (type symbol symbol)) + (cond ((eq symbol t) + (error "Veritas aeterna. (can't change T)")) + ((eq symbol nil) + (error "Nihil ex nihil. (can't change NIL)")) + ((keywordp symbol) + (error "Keyword values can't be changed.")) + ;; (Just because a value is CONSTANTP is not a good enough + ;; reason to complain here, because we want DEFCONSTANT to + ;; be able to use this function, and it's legal to DEFCONSTANT + ;; a constant as long as the new value is EQL to the old + ;; value.) + )) #| ;;; REMOVEME when done testing byte cross-compiler