unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: 67008@debbugs.gnu.org, Ikumi Keita <ikumi@ikumi.que.jp>,
	Yuan Fu <casouri@gmail.com>, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#67008: 30.0.50; Multiple major mode parents
Date: Mon, 13 Nov 2023 08:30:22 -0500	[thread overview]
Message-ID: <jwvh6lpre1g.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <7C4E82A5-0F5A-4E04-B2BD-AD6DEC56A8C0@gmail.com> ("Mattias Engdegård"'s message of "Mon, 13 Nov 2023 13:45:59 +0100")

>> I improved the docstring to try and clarify.
> Thank you, but the new text,
>> +The order of the (sub)lists determines the final order in those cases where
>> +the order within the sublists does not impose a unique choice.
> still doesn't explain how the sublist order affects the choice of linearisation.

Suggestions welcome to make it better.  I couldn't come up with
a wording that is both short enough and clear.

> Since I'm here:
>>      (while (cdr (setq lists (delq nil lists)))
> When this loop is entered the first time, `lists` still holds the argument
> which probably shouldn't be mutated even if it's for removing empty lists
> inside. (In later iterations it seems to be a copy.)

I guess you're right.  The list passed to it is always freshly made, so
it's not a real problem in practice, but it's a bit ugly.

> +(ert-deftest subt-tests--merge-ordered-lists ()
>                  ^
>                  r

Damn, you caught my subt-erfuge!

> +  (should (equal (merge-ordered-lists
> +                  '((B A) (C A) (D B) (E D C)))
> +                 '(E D B C A)))
> +  (should (equal (merge-ordered-lists
> +                  '((E D C) (B A) (C A) (D B)))
> +                 '(E D C B A)))
> +  (should-error (merge-ordered-lists
> +                 '((E C D) (B A) (A C) (D B))
> +                 (lambda (_) (error "cycle")))))
>
> All calls should error on cycles, not just the one that actually contains one.

Fair enough.

> Maybe the default value for the `error-function` argument should be one that
> raises an error, so that callers need to specify something explicitly if
> they want a different behaviour?

I decided against that because the existing evidence is that we prefer
to hide the problem than to signal an error.  Part of the issue is also
that in practice most "cycles" aren't real: they are the result of
submode/subtype relationships where two types/modes have linearized their
parents in incompatible ways.

E.g. C inherits from (A B)
     D inherits from (B A)
     E inherits from (C D)

there is no cycle in the inheritance, but since the linearization is
done piecemeal (a.k.a locally), you get to merge

    ((C A B) (D B A))

and that finds a "cycle".  That's why EIEIO calls it
`inconsistent-class-hierarchy` rather than `cycle`.


        Stefan






  reply	other threads:[~2023-11-13 13:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09  5:38 bug#67008: 30.0.50; Multiple major mode parents Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-09  7:43 ` Yuan Fu
2023-11-12 22:11   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 15:16     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-11  0:01 ` Dmitry Gutov
2023-11-11  4:23   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-11 10:14 ` Mattias Engdegård
2023-11-11 16:20   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-11 18:12     ` Mattias Engdegård
2023-11-11 18:43       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-11 20:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-12 13:37       ` Mattias Engdegård
2023-11-12 16:41         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-13 12:45           ` Mattias Engdegård
2023-11-13 13:30             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-11-13 16:44               ` Mattias Engdegård
2023-11-13 17:46                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 11:07                   ` Mattias Engdegård
2023-11-16 15:15                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-16 19:35                       ` Mattias Engdegård
2023-11-16 21:40                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-17 14:04                           ` Mattias Engdegård
2023-11-17 14:20                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-17 16:15                               ` Mattias Engdegård
2023-11-11 12:21 ` Ikumi Keita
2023-11-11 16:57   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-12  9:50     ` Ikumi Keita
2023-11-12 16:04       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=jwvh6lpre1g.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67008@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=ikumi@ikumi.que.jp \
    --cc=mattias.engdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).