(defpackage #:clsafe (:use #:cl) (:shadow :defmethod :setq :setf :set) (:export )) (in-package #:clsafe) (defmacro lexical-boundp (symbol) `(if (ignore-errors (or (null ,symbol) (not (null ,symbol)))) t nil)) (defun specialp (symbol) (or (boundp symbol) (eval `(let ((,symbol )) (boundp ',symbol))))) (defmacro setq (&rest pairs) `(and ,@(loop :for (symbol value) :on pairs :by #'cddr :collect `(or (lexical-boundp ,symbol) (specialp ',symbol) (error "Variable ~A doesn't exist." ',symbol))) (cl:setq ,@pairs))) (specialp '*standard-output*);=>t (specialp '*yyy);=>nil (lexical-boundp *yyy*);=>nil (defvar *y*) (specialp '*y*);=>t (lexical-boundp *y*);=>nil (setq *y* 3);=>3 (lexical-boundp *y*);=>t (setq a 3);The variable A doesn't exist. [Condition of type SIMPLE-ERROR (let ((a)) (lexical-boundp a) ;=>t (setq a 5)) ;=>5