[Top][All Lists]

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

Re: [PATCH] pcase.el: Add type pattern

From: Michael Heerdegen
Subject: Re: [PATCH] pcase.el: Add type pattern
Date: Tue, 10 Mar 2020 18:43:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Adam Porter <address@hidden> writes:

> My understanding was that adding the (require 'cl-lib) form was
> suggested if the definition was left in pcase.el, and if the definition
> were added to cl-macs.el instead, the (require 'cl-lib) form would not
> be needed.

Oh, I missed that, then sorry for the noise.

> 1.  Run emacs -Q.
> 2.  Evaluate this form in *scratch*:
>   (pcase-defmacro type (type)
>     "Pcase pattern that matches objects of TYPE.
>   TYPE is a symbol or list as accepted by `cl-typep', which see."
>     `(pred (pcase--flip cl-typep ',type)))
> 3.  Evaluate this form in *scratch*:
>   (macroexpand-all '(pcase 10 ((type (integer 0 10)) t)))
> Result:
>   (if (and (integerp 10) (>= 10 (quote 0)) (<= 10 (quote 10))) (progn t)
>   nil)

No, I don't see that here.  I'm using current master here.

> However, I have attached another version of the patch which adds an
> autoload for the (pcase-defmacro type) form, which seems proper since
> the (pcase-defmacro cl-struct) form in the same file also has one.

What effect does this have?  Since it's no defmacro from, the form is
just copied literally to the generated loaddefs file, right?  Wouldn't
that make a an explicit `require' in the definition necessary?


reply via email to

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