emacs-devel
[Top][All Lists]
Advanced

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

Re: master 68c09c6: Better CPS conversion of multi-binding `let`


From: Stefan Monnier
Subject: Re: master 68c09c6: Better CPS conversion of multi-binding `let`
Date: Tue, 30 Nov 2021 08:19:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> -    ;; Process `let' in a helper function that transforms it into a
> -    ;; let* with temporaries.
> +    (`(,(or 'let 'let*) () . ,body)
> +      (cps--transform-1 `(progn ,@body) next-state))
> +
> +    (`(let (,binding) . ,body)
> +      (cps--transform-1 `(let* (,binding) ,@body) next-state))
> +
> +    ;; Transform multi-variable `let' into `let*':
> +    ;;    (let ((v1 e1) ... (vN eN)) BODY)
> +    ;; -> (let* ((t1 e1) ... (tN eN) (v1 t1) (vN tN)) BODY)

I think this optimization can be generalized to the multi-var case by
noticing that the transformation of (vN eN) into a pair (tN eN) ... (vN tN)
is not necessary because the order of the (v1 t1) ... (vN tN) doesn't matter
so we can move (vN tN) to the beginning, right next to (tN eN) and then
merge them back.


        Stefan




reply via email to

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