emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114063: * lisp/emacs-lisp/cl-macs.el (cl-defsubst):


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114063: * lisp/emacs-lisp/cl-macs.el (cl-defsubst): Make it clear that args
Date: Thu, 29 Aug 2013 03:49:15 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114063
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-28 23:49:10 -0400
message:
  * lisp/emacs-lisp/cl-macs.el (cl-defsubst): Make it clear that args
  are immutable.  Don't use `unsafe' any more.
  (cl--defsubst-expand): Don't substitute at the same time as keeping
  a residual unused let-binding.  Don't use `unsafe' any more.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/cl-macs.el     clmacs.el-20091113204419-o5vbwnq5f7feedwu-612
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-29 03:21:33 +0000
+++ b/lisp/ChangeLog    2013-08-29 03:49:10 +0000
@@ -1,3 +1,10 @@
+2013-08-29  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/cl-macs.el (cl-defsubst): Make it clear that args
+       are immutable.  Don't use `unsafe' any more.
+       (cl--defsubst-expand): Don't substitute at the same time as keeping
+       a residual unused let-binding.  Don't use `unsafe' any more.
+
 2013-08-29  Glenn Morris  <address@hidden>
 
        * calendar/cal-china.el (calendar-chinese-year-cache):

=== modified file 'lisp/emacs-lisp/cl-macs.el'
--- a/lisp/emacs-lisp/cl-macs.el        2013-08-13 02:30:52 +0000
+++ b/lisp/emacs-lisp/cl-macs.el        2013-08-29 03:49:10 +0000
@@ -2693,15 +2693,16 @@
 ;;;###autoload
 (defmacro cl-defsubst (name args &rest body)
   "Define NAME as a function.
-Like `defun', except the function is automatically declared `inline',
+Like `defun', except the function is automatically declared `inline' and
+the arguments are immutable.
 ARGLIST allows full Common Lisp conventions, and BODY is implicitly
 surrounded by (cl-block NAME ...).
+The function's arguments should be treated as immutable.
 
 \(fn NAME ARGLIST [DOCSTRING] BODY...)"
   (declare (debug cl-defun) (indent 2))
   (let* ((argns (cl--arglist-args args)) (p argns)
-        (pbody (cons 'progn body))
-        (unsafe (not (cl--safe-expr-p pbody))))
+        (pbody (cons 'progn body)))
     (while (and p (eq (cl--expr-contains args (car p)) 1)) (pop p))
     `(progn
        ,(if p nil   ; give up if defaults refer to earlier args
@@ -2717,10 +2718,10 @@
               ;; does not pay attention to the argvs (and
               ;; cl-expr-access-order itself is also too naive).
               nil
-              ,(and (memq '&key args) 'cl-whole) ,unsafe ,@argns)))
+              ,(and (memq '&key args) 'cl-whole) nil ,@argns)))
        (cl-defun ,name ,args ,@body))))
 
-(defun cl--defsubst-expand (argns body simple whole unsafe &rest argvs)
+(defun cl--defsubst-expand (argns body simple whole _unsafe &rest argvs)
   (if (and whole (not (cl--safe-expr-p (cons 'progn argvs)))) whole
     (if (cl--simple-exprs-p argvs) (setq simple t))
     (let* ((substs ())
@@ -2728,7 +2729,7 @@
                        (cl-mapcar (lambda (argn argv)
                                     (if (or simple (macroexp-const-p argv))
                                         (progn (push (cons argn argv) substs)
-                                               (and unsafe (list argn argv)))
+                                               nil)
                                       (list argn argv)))
                                   argns argvs))))
       ;; FIXME: `sublis/subst' will happily substitute the symbol


reply via email to

[Prev in Thread] Current Thread [Next in Thread]