emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: Is this a bug in while-let or do I missunderstand i


From: Alfred M. Szmidt
Subject: Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?
Date: Sat, 09 Nov 2024 15:38:06 -0500

   > If the bindings are to be reevaluated on each iteration, shouldn't B
   > always be NIL, and that it would end up with (< NIL end) would be on
   > each iteration causing an error?

   I hope I don't miss anything important here, but I think the
   first two elements in SPEC of below `while-let'

     (while-let ((b)
                 ((< b end))
                 (e (next-single-property-change (1+ b) 'erc--msg nil end)))
       ...)

   do not actually bind anything, they only test.  The doc string of
   `if-let' has:

if-let is not while-let.  If while-let is supposed to do something
weird like that .. then it should mention it.  The examples in the
manual contradict the behaviour, so does the text in the manual.

>From the looks, these macros try to be way to smart.

     Each element of SPEC is a list (SYMBOL VALUEFORM) that binds
     SYMBOL to the value of VALUEFORM.  An element can additionally be
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     of the form (VALUEFORM), which is evaluated and checked for nil;
     ^^^^^^^^^^^^^^^^^^^^^^^
     i.e. SYMBOL can be omitted if only the test result is of
     interest.  It can also be of the form SYMBOL, then the binding of
     SYMBOL is checked for nil.

   I'd align such clauses like this:

     (while-let ((  b)
                 (  (< b end))
                 (e (next-single-property-change (1+ b) 'erc--msg nil end)))
       ...)

   to emphasize that.





reply via email to

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