[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cond* vs pcase
From: |
Philip Kaludercic |
Subject: |
Re: cond* vs pcase |
Date: |
Tue, 06 Feb 2024 18:57:43 +0000 |
"Alfred M. Szmidt" <ams@gnu.org> writes:
> > Because your not doing pattern matching, you're comparing against a
> > set of strings/symbols/numbers/....
>
> Simply because pattern matching is a more powerful generalisation,
> capable of expressing case-distinction; in the end it compiles down to
> almost the same code anyway.
>
> Are you suggesting that COND/CASE/... and other "trivial" matching
> constructs should be replaced with PCASE/COND*?
No, just that using pcase in these cases isn't wrong.
Drew Adams <drew.adams@oracle.com> writes:
>> Simply because [1] pattern matching is a more
>> powerful generalisation, capable of expressing
>> case-distinction; [2] in the end it compiles
>> down to almost the same code anyway.
>
> Wow. Really _not_ a good reason (IMHO).
> Neither of those reasons [1,2] is good.
>
> With that reasoning you'll use `pcase'
> _always and everywhere_ - never `if',
> `cond', `let', `or', `and',...
Please don't be dishonest; My question was why cl-case was more
appropriate than pcase, where both are macros that boil down to simpler
primitives. I don't see an inherent advantage to using the more
specific abstraction over the more generic one. I like pcase, and
prefer using it in my code, but if you've got some code that is already
using a lot of cl-lib and no pcase, then there is no point in transiting
cl-case forms into pcase.
>
> Hey, `pcase' can do it all! And it
> compiles down to almost the same thing!
>
> "Demain on rase gratis !"
- cond* vs pcase, Arthur Miller, 2024/02/05
- Re: cond* vs pcase, Eli Zaretskii, 2024/02/05
- Re: cond* vs pcase, Alfred M. Szmidt, 2024/02/05
- Re: cond* vs pcase, Philip Kaludercic, 2024/02/05
- Re: cond* vs pcase, Arthur Miller, 2024/02/06
- Re: cond* vs pcase, Alfred M. Szmidt, 2024/02/06
- RE: [External] : Re: cond* vs pcase, Drew Adams, 2024/02/06
- Re: cond* vs pcase, Philip Kaludercic, 2024/02/06
- Re: cond* vs pcase, Alfred M. Szmidt, 2024/02/06
- Re: cond* vs pcase,
Philip Kaludercic <=
- Re: cond* vs pcase, Alfred M. Szmidt, 2024/02/06
- Re: cond* vs pcase, Philip Kaludercic, 2024/02/06
- RE: [External] : Re: cond* vs pcase, Drew Adams, 2024/02/06
- RE: [External] : Re: cond* vs pcase, Drew Adams, 2024/02/06
- RE: [External] : Re: cond* vs pcase, Adam Porter, 2024/02/06
- RE: [External] : Re: cond* vs pcase, Drew Adams, 2024/02/06
- Re: [External] : Re: cond* vs pcase, Arthur Miller, 2024/02/07
- Re: [External] : Re: cond* vs pcase, Po Lu, 2024/02/07
- RE: [External] : Re: cond* vs pcase, Drew Adams, 2024/02/07
- Re: [External] : Re: cond* vs pcase, Tomas Hlavaty, 2024/02/07