Plaster

common-lisp
(defmacro static-let ((name init &optional (type t)) &body body) (let ((x (gensym))) `(locally (declare (special ,x)) (unless (boundp ',x) (setf ,x ,init)) (symbol-macrolet ((,name (the ,type ,x))) ,@body)))) (defun bar () (declare (optimize (speed 3))) (static-let (x 0 fixnum) (incf x)))