emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for cond*


From: JD Smith
Subject: Re: Code for cond*
Date: Thu, 25 Jan 2024 11:33:00 -0500


> On Jan 25, 2024, at 11:12 AM, Alfred M. Szmidt <ams@gnu.org> wrote:
> 
> The above "idiom" is much easier to understand since it just uses well
> known Lisp behaviour than modifying cond even if it is really ugly
> ... the feature is a nice addition, but is it worth it?

I tend to agree that wrapping the entire cond in let is not too bad.  It 
increases indentation depth for a very common need, but has the advantage that 
you “look up to parent forms for the bindings” which I think is natural for 
most elisp developers.

There is however no equivalent simple idiom for cond-let — a proposed member of 
the if-let/when-let family.  Unless, that is, you consider this simple:

(catch 'cond-let
 (when simple0 (throw 'cond-let body0))
 (when-let (bindings1) (throw 'cond-let body1))
 (when-let (bindings2) (throw 'cond-let body2))
 (when-let (bindings3) (throw 'cond-let body3))
 (throw 'cond-let fallthrough-body))



reply via email to

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