[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase bindings in patterns with complicated logic
From: |
Thierry Volpiatto |
Subject: |
Re: pcase bindings in patterns with complicated logic |
Date: |
Sun, 14 Jan 2024 15:58:56 +0000 |
Ihor Radchenko <yantar92@posteo.net> writes:
> Thierry Volpiatto <thievol@posteo.net> writes:
>
>> [ BTW I don't understand why `app` pattern exists as long as now `pred` is
>> supporting an extra arg ]
>
> Isn't it explained right in the manual?
>
> ‘(app FUNCTION PATTERN)’
> Matches if FUNCTION called on EXPVAL returns a value that matches
> PATTERN. FUNCTION can take one of the forms described for ‘pred’,
> above. Unlike ‘pred’, however, ‘app’ tests the result against
> PATTERN, rather than against a boolean truth value.
Perhaps it is right but I don't understand it, an example in the manual
would be welcome (if there is one I missed it).
>> Also I would give a warning to extensions developers that want
>> compatibility with older emacs:
>>
>> pcase has evolved and doesn't behave as in older emacs, so try you pcase
>> statements on each emacs you want to support, for example (pred (not
>> ...)) is not supported in older Emacs.
>
> Compiler takes care about this warnings. For example,
> (pcase '(1)
> ((pred (not cdr)) "true"))
>
> in Emacs 26 will indicate problems
>
> Compiling file /tmp/test.el at Sun Jan 14 16:41:32 2024
> test.el:2:15:Warning: reference to free variable ‘cdr’
I already hit this warning and had hard time figuring what was wrong, in
test.el it is easy to find but in a large file the compiler doesn't
bring you always to the right place.
--
Thierry
signature.asc
Description: PGP signature
- pcase bindings in patterns with complicated logic, Richard Stallman, 2024/01/12
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/13
- Re: pcase bindings in patterns with complicated logic, Thierry Volpiatto, 2024/01/14
- Re: pcase bindings in patterns with complicated logic, Thierry Volpiatto, 2024/01/14
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/14
- Re: pcase bindings in patterns with complicated logic,
Thierry Volpiatto <=
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/14
- Re: pcase bindings in patterns with complicated logic, Thierry Volpiatto, 2024/01/14
- Re: pcase bindings in patterns with complicated logic, Richard Stallman, 2024/01/15
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/16
- Re: pcase bindings in patterns with complicated logic, Richard Stallman, 2024/01/17
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/18
- Re: pcase bindings in patterns with complicated logic, Richard Stallman, 2024/01/19
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/20
- Re: pcase bindings in patterns with complicated logic, Richard Stallman, 2024/01/20
- Re: pcase bindings in patterns with complicated logic, Ihor Radchenko, 2024/01/21