help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Closures - do you understand them well?


From: tomas
Subject: Re: Closures - do you understand them well?
Date: Fri, 9 Dec 2022 05:49:34 +0100

On Thu, Dec 08, 2022 at 05:00:14PM -0500, Stefan Monnier via Users list for the 
GNU Emacs text editor wrote:
> >> In ELisp, both `dotimes` and `dolist` create a new binding for `i` at
> >> each iteration of the loop.
> > This is probably what most people expect from a loop.
> 
> I find this behavior cleaner, indeed (which is why I changed `dotimes`
> and `dolist` to provide that behavior :-).

This is funny. I did come up with the right answer. Truth be
said, Michael's "tone" was set up in a way to raise awareness
("now, look carefully"), so this has surely played a role.

That said, this is actually the behaviour I expect (and like),
so reading your note taught me something: expectations here
seem to vary, and mine isn't the "only", much less the "right"
one. And I might meet loop constructs with local bindings :)

So I learnt something from the riddle, after all [1].

> > `cl-loop' doesn't.
> 
> Indeed, when I looked at it, I decided it was too much trouble figuring
> out how to change `cl-loop` to provide that behavior :-(
> IMO `cl-loop` is too complex for its own good.

Uh-huh. I never wanted to learn a whole language to just do
looping :-)

Thanks for the riddle and all the follow-up!

[1] The most general rule seems still to be: "all generalisations
   suck"

-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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