emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] pcase.el: Add cl-type and type patterns


From: Adam Porter
Subject: Re: [PATCH] pcase.el: Add cl-type and type patterns
Date: Sat, 17 Jul 2021 11:07:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +@item (cl-type @var{type})
>> +Matches if @var{expval} is of type @var{type}, which is a symbol or
>> +list as accepted by @ref{cl-typep,,,cl,Common Lisp Extensions}.
>
> Rather than mention "symbol or list", I'd only refer to `cl-typep`,
> maybe something like:
>
>     Matches if @var{expval} is of type @var{type}, which is type descriptor
>     as accepted by @ref{cl-typep,,,cl,Common Lisp Extensions}.
>
> The rest of the first patch looks good to me.

Thanks, I've made this change in the attached patch.  (FYI, Eli
recommends against using the @ref style, see
<https://lists.gnu.org/archive/html/emacs-devel/2021-07/msg00083.html>.)

> I'm not convinced this second patch is worth the trouble:
>
>     (type FOO)
>
> is not significantly shorter or simpler than
>
>     (pred FOO-p)

It's not significantly shorter, but it does make the purpose a bit more
obvious at a glance ("type" vs. "pred").  :)  But anyway...

> but it is inherently brittle because `intern-soft` may
> return non-nil even though there's no predicate by that name, and it may
> also let you use a "type" which really isn't one such as
> `cl--struct-name` or `looking-at`.
>
> `cl-type` provides that functionality in a cleaner and more
> reliable way (it still also relies to some extent on similar heuristic
> as your code, admittedly, but I've been working to get rid of it).

I understand.  Thanks for your work on that.  I've omitted the "type"
patch from this update.

Thanks for all your help.

Attachment: 0001-lisp-emacs-lisp-cl-macs.el-Add-cl-type-pattern.patch
Description: Add cl-type matcher


reply via email to

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