emacs-devel
[Top][All Lists]
Advanced

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

Re: trunk r117969: Font-lock `cl-flet*', too.


From: Stefan Monnier
Subject: Re: trunk r117969: Font-lock `cl-flet*', too.
Date: Mon, 29 Sep 2014 09:15:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>  \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
>    (declare (indent 1) (debug cl-flet))
> -  (let ((binds ()) (newenv macroexpand-all-environment))
> +  (let ((binds ())
> +     (setqs ())
> +     (newenv macroexpand-all-environment)
> +     (deps (mapcar #'car bindings)))
>      (dolist (binding bindings)
>        (let ((var (make-symbol (format "--cl-%s--" (car binding)))))
> -     (push (list var `(cl-function (lambda . ,(cdr binding)))) binds)
> +     (if (cl--labels-depend-p (cddr binding) deps)
> +         (progn
> +           (push var binds)
> +           (push `(setq ,var (cl-function (lambda . ,(cdr binding)))) setqs))
> +       (push (list var `(cl-function (lambda . ,(cdr binding)))) binds))
>       (push (cons (car binding)
> -                    `(lambda (&rest cl-labels-args)
> -                       (cl-list* 'funcall ',var
> -                                 cl-labels-args)))
> -              newenv)))
> -    (macroexpand-all `(letrec ,(nreverse binds) ,@body)
> -                     ;; Don't override lexical-let's macro-expander.
> -                     (if (assq 'function newenv) newenv
> -                       (cons (cons 'function #'cl--labels-convert) 
> newenv)))))
> +                 `(lambda (&rest cl-labels-args)
> +                    (cl-list* 'funcall ',var cl-labels-args)))
> +           newenv))
> +      (pop deps))
> +    (macroexpand-all `(let* ,(nreverse binds)
> +                     ,@(nreverse setqs)
> +                     ,@body)
> +                  ;; Don't override lexical-let's macro-expander.
> +                  (if (assq 'function newenv) newenv
> +                    (cons (cons 'function #'cl--labels-convert) newenv)))))
 
I'd rather not expand each binding twice: the cl--labels-convert
function can collect the dependencies as it does the expansion.

Also, I'd prefer to use `letrec' rather than hardcode its expansion here
(letrec really should be a special-form, so the byte-compiler can
implement it more efficiently).


        Stefan



reply via email to

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