[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: new `pcase-let' syntax
From: |
Emanuel Berg |
Subject: |
Re: [External] : Re: new `pcase-let' syntax |
Date: |
Sat, 26 Nov 2022 17:01:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Drew Adams wrote:
>>> (pcase-let ((`(,up ,down)
>>> (if button
>>> `(,#'backward-button ,#'forward-button)
>>> `(,#'previous-line ,#'forward-line)))) ...)
>>
>> [...] I also get the feeling this is a hack for the sake of
>> a hack. Is it really that much better than the "classical"
>>
>> (let ((up #'previous-line) (down #'forward-line))
>> (when button (setq up #'backward-button down #'forward-button))...)
>
> It gives you more opportunities to use your `,', ``', and
> `)' keys?
Okay, so how do you do this the classical way then?
(pcase-let*((`(,sail ,ho) (if t '(1 2) '(3 4)))
(msg (format "%s is %s" sail ho)) )
msg)
Also, it's better than `let' and `setq' because if you make
a typo setq creates a global variable, a bug that silently
enters your code.
Obviously if you gonna do typos all day ever day that's gonna
be a problem even with pcase-let LOL
--
underground experts united
https://dataswamp.org/~incal