unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Andrew Hyatt <ahyatt@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: pcase defuns
Date: Sun, 19 Dec 2021 18:16:29 +0100	[thread overview]
Message-ID: <87y24g4hsb.fsf@gnu.org> (raw)
In-Reply-To: <m2fsqoehjb.fsf@andrews-mbp.lan>

Andrew Hyatt <ahyatt@gmail.com> writes:

Hi Andrew,

> I have a solution for this: a crude one: I just sort all the rules
> according to their flattened length. So the most complicated ones
> should get tried first, which I think is something that can
> communicated to the user.

Hm, well, in that case (a ,var) is longer than (a b) so the former will
always be taken although a user might have them ordered the other way
round and expect (a ,var) only to match if the second argument is not b.

> You've hit upon the issue with these types of systems.  Powerful, easy
> to use, but dispatch rules are always vague.  The same thing can
> happen with cl-defmethod, IIRC, where you can have two rules that both
> seem like they should take precedence.

Oh dear, my head becomes dizzy when reading their dispatch behavior at
(info "(elisp) Generic Functions").  Well, I mean, the typical uses can
be pretty easy to understand but if you mix and match different kinds of
specifiers, it becomes unwieldy, like what happens when you have two
methods where one specifies the first argument must be an integer and
the other says it applies if the first argument is (eql 42) [where 42 is
obviously an integer]?  I can't read a priority order between different
kinds of specifiers...

Bye,
Tassilo



  reply	other threads:[~2021-12-19 17:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-19  4:53 pcase defuns Andrew Hyatt
2021-12-19  8:34 ` Tassilo Horn
2021-12-19 15:33   ` Andrew Hyatt
2021-12-19 17:16     ` Tassilo Horn [this message]
2021-12-19 19:05       ` Stefan Monnier
2021-12-20  5:56         ` Tassilo Horn
2021-12-22 14:07   ` LdBeth
2021-12-19 17:23 ` Stefan Monnier
2021-12-19 21:08   ` Andrew Hyatt
2021-12-21  4:15     ` Richard Stallman
2021-12-21  5:20       ` Andrew Hyatt
2021-12-22  4:18         ` Richard Stallman
2021-12-23  1:52           ` Andrew Hyatt
2021-12-24  4:13             ` Richard Stallman
2021-12-21 15:32     ` Stefan Monnier
2021-12-20  4:43 ` Richard Stallman
2021-12-23  2:30 ` Po Lu
2022-03-26 17:41 ` Andrew Hyatt
2022-03-27  9:31   ` Stefan Monnier
2022-03-27 18:17     ` Andrew Hyatt
2022-03-28  4:15   ` Richard Stallman
2022-03-30  1:28     ` Andrew Hyatt
2022-03-31  4:27       ` Richard Stallman
2022-04-17 22:09         ` Andrew Hyatt
2022-04-19  3:48           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y24g4hsb.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=ahyatt@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).