comparison lisp/cl-macs.el @ 5553:62edcc6a11ec

Add an assertion about argument order to #'apply-partially compiler macro lisp/ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (apply-partially): Add an assertion to this compiler macro, requiring that the order of the placeholders corresponding to the arguments in the constants vector of the constructed compiled function be the same as the order of the arguments to #'apply-partially. tests/ChangeLog addition: 2011-08-24 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Add a test of apply partially that depends on the relative order of its arguments.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 24 Aug 2011 11:06:41 +0100
parents b908c7265a2b
children 9a93bc90b3bd
comparison
equal deleted inserted replaced
5550:b908c7265a2b 5553:62edcc6a11ec
3517 (if (cl-const-exprs-p args) 3517 (if (cl-const-exprs-p args)
3518 `#'(lambda (&rest args) (apply ,@args args)) 3518 `#'(lambda (&rest args) (apply ,@args args))
3519 (let* ((placeholders (mapcar 'quote-maybe (mapcar 'gensym args))) 3519 (let* ((placeholders (mapcar 'quote-maybe (mapcar 'gensym args)))
3520 (compiled (byte-compile-sexp 3520 (compiled (byte-compile-sexp
3521 `#'(lambda (&rest args) (apply ,@placeholders args))))) 3521 `#'(lambda (&rest args) (apply ,@placeholders args)))))
3522 (assert (equal (intersection
3523 (mapcar 'quote-maybe (compiled-function-constants
3524 compiled))
3525 placeholders :test 'equal :stable t)
3526 placeholders)
3527 t "This macro requires that the relative order is the same\
3528 in the constants vector and in the arguments")
3522 `(make-byte-code 3529 `(make-byte-code
3523 ',(compiled-function-arglist compiled) 3530 ',(compiled-function-arglist compiled)
3524 ,(compiled-function-instructions compiled) 3531 ,(compiled-function-instructions compiled)
3525 (vector ,@(sublis (pairlis placeholders args) 3532 (vector ,@(sublis (pairlis placeholders args)
3526 (mapcar 'quote-maybe 3533 (mapcar 'quote-maybe