[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [nongnu] elpa/racket-mode 363246ac70 1/2: Fix cl-loop byte-compiler
From: |
Stefan Monnier |
Subject: |
Re: [nongnu] elpa/racket-mode 363246ac70 1/2: Fix cl-loop byte-compiler warnings |
Date: |
Mon, 18 Sep 2023 16:36:00 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> If instead of `setq` cl-loop expanded to use `let`
>
> (lambda
> (--cl-var1-- --cl-var2--)
> (let ((i (cons --cl-var1-- --cl-var2--))
> (racket--region-set-face
> (car i)
> (cdr i)
> (funcall func
> (or
> (get-text-property
> (car i)
> 'face)
> 'default))
> 'force))))
Yes, that's pretty much what Emacs-30 generates now.
> would that avoid the byte-compiler warning?
Yup.
> If not, can it add an `ignore`?
Yes and no:
- It can add one within the `let` but that would be useless
because the internal `i` *is* used already.
- It can't really add one outside the `let` because that would cause
warnings again if the surrounding code doesn't use an extra `let` to
define that (external) `i`.
> I guess my general question is: If I can hand-write code to avoid the
> warning, and macros can write any code that I can write by hand, why
> can't cl-loop do so for me?
Because as human you get to make a decision based on more information
than the macro so you'd sometimes put an `ignore` and sometimes not but
the macro can't guess when to put one and when not to.
Stefan