GNU bug report logs -
#67611
[PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Previous Next
Reported by: Okamsn <okamsn <at> protonmail.com>
Date: Sun, 3 Dec 2023 20:35:01 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Stefan Monnier wrote:
>> The attached patch adds the pattern `cl-lambda` for Pcase, which works
>> like `cl-destructuring-bind`. There are two differences with the lambda
>> lists:
>
> Hmm... I'm not sure mixing the CL destructuring patterns with the Pcase
> patterns (both of which are rather featureful and complex) will help
> their popularity.
>
> Beside that problem (which means I'm not very favorable to the
> addition), the name should be changed because "lambda" is misleading.
> It suggests this has to do with a function (I had to read the code to
> understand what this is doing).
>
>> The pattern is useful when one wants to combine the features of `pcase`
>> and `cl-destructuring-bind`, such combining the optional values with the
>> `pred` or `guard` patterns.
>
> Do you have examples uses?
>
> Maybe we could introduce a different Pcase pattern which covers those
> needs but stays closer to the Pcase pattern syntax?
>
>
> Stefan
>
Hello,
Because I wrote this patch with the thought that others might want it, I
don't have any nontrivial examples to share right now. The best example
I have for the use of the optional arguments is for the implementing of
the optional arguments, which isn't very convincing.
I've updated the patch to rename the pattern to `cl-arglist` and to
avoid creating intermediate variables using the `let` pattern, but I'm
fine with resting the discussion here until a stronger argument can be
made in favor of the patch.
Thank you.
[v2-0001-Add-the-Pcase-pattern-cl-arglist-for-matching-a-C.patch (text/x-patch, attachment)]
This bug report was last modified 146 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.