comparison lisp/cl-macs.el @ 5269:90a0084b3541

Rephrase the #'the docstring, make it nicer while byte-compiling. lisp/ChangeLog addition: 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment): * cl-macs.el (the): Rephrase the docstring, make its implementation when compiling files a little nicer.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 16 Sep 2010 15:34:35 +0100
parents f9ec07abdbf9
children 99de5fd48e87 308d34e9f07d
comparison
equal deleted inserted replaced
5268:09f8ed0933c7 5269:90a0084b3541
1961 1961
1962 ;;;###autoload 1962 ;;;###autoload
1963 (defmacro locally (&rest body) (cons 'progn body)) 1963 (defmacro locally (&rest body) (cons 'progn body))
1964 ;;;###autoload 1964 ;;;###autoload
1965 (defmacro the (type form) 1965 (defmacro the (type form)
1966 "Assert that FORM gives a result of type TYPE, and return FORM. 1966 "Assert that FORM gives a result of type TYPE, and return that result.
1967 1967
1968 TYPE is a Common Lisp type specifier. 1968 TYPE is a Common Lisp type specifier.
1969 1969
1970 If macro expansion of a `the' form happens during byte compilation, and the 1970 If macro expansion of a `the' form happens during byte compilation, and the
1971 byte compiler customization variable `byte-compile-delete-errors' is 1971 byte compiler customization variable `byte-compile-delete-errors' is
1972 non-nil, `the' just returns FORM, without making any type checks." 1972 non-nil, `the' is equivalent to FORM without any type checks."
1973 (if (cl-safe-expr-p form) 1973 (if (cl-safe-expr-p form)
1974 `(prog1 ,form (assert ,(cl-make-type-test form type) t)) 1974 `(prog1 ,form (assert ,(cl-make-type-test form type) t))
1975 (let ((saved (gensym))) 1975 (let ((saved (gensym)))
1976 `(let ((,saved ,form)) 1976 `(let ((,saved ,form))
1977 (prog1 ,saved (assert ,(cl-make-type-test saved type) t)))))) 1977 (prog1 ,saved (assert ,(cl-make-type-test saved type) t))))))