comparison lisp/cl.el @ 5651:ae2fdb1fd9e0

Improve for-effect handling in a few places, lisp/ lisp/ChangeLog addition: 2012-05-01 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (byte-optimize-form-code-walker): * byte-optimize.el (byte-optimize-or): Improve handling of for-effect here; we don't need to worry about discarding multiple values when for-effect is non-nil, this applies to both #'prog1 and #'or. * bytecomp.el (progn): * bytecomp.el (byte-compile-file-form-progn): New. Put back this function, since it's for-effect there's no need to worry about passing back multiple values. * cl-macs.el (cl-pop2): * cl-macs.el (cl-do-pop): * cl-macs.el (remf): * cl.el (pop): Expand to (prog1 (car-safe PLACE) (setq PLACE (cdr PLACE))) in all these macros, since that optimizes better (especially for-effect handling) when byte-compile-delete-errors is nil.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 01 May 2012 12:43:22 +0100
parents bd80d9103fc8
children
comparison
equal deleted inserted replaced
5650:7fa8667cdaa7 5651:ae2fdb1fd9e0
150 "Remove and return the head of the list stored in PLACE. 150 "Remove and return the head of the list stored in PLACE.
151 Analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))), though more 151 Analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))), though more
152 careful about evaluating each argument only once and in the right order. 152 careful about evaluating each argument only once and in the right order.
153 PLACE may be a symbol, or any generalized variable allowed by `setf'." 153 PLACE may be a symbol, or any generalized variable allowed by `setf'."
154 (if (symbolp place) 154 (if (symbolp place)
155 `(car (prog1 ,place (setq ,place (cdr ,place)))) 155 `(car-safe (prog1 ,place (setq ,place (cdr ,place))))
156 (cl-do-pop place))) 156 (cl-do-pop place)))
157 157
158 (defmacro push (newelt listname) 158 (defmacro push (newelt listname)
159 "Add NEWELT at the beginning of the list stored in LISTNAME. 159 "Add NEWELT at the beginning of the list stored in LISTNAME.
160 Analogous to (setf LISTNAME (cons NEWELT LISTNAME)), though more careful 160 Analogous to (setf LISTNAME (cons NEWELT LISTNAME)), though more careful