From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#66615: 30.0.50; Inconsistent 'number-or-marker' type definition in the cl- machinery Date: Sun, 22 Oct 2023 03:03:19 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33921"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 66615@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 22 09:03:54 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1quSV7-0008Yn-SN for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Oct 2023 09:03:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quSUp-0003bY-IE; Sun, 22 Oct 2023 03:03:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quSUo-0003YM-04 for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 03:03:34 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quSUn-0004Xw-Mq for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 03:03:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1quSVF-0004Nr-Mg for bug-gnu-emacs@gnu.org; Sun, 22 Oct 2023 03:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Oct 2023 07:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66615 X-GNU-PR-Package: emacs Original-Received: via spool by 66615-submit@debbugs.gnu.org id=B66615.169795824016844 (code B ref 66615); Sun, 22 Oct 2023 07:04:01 +0000 Original-Received: (at 66615) by debbugs.gnu.org; 22 Oct 2023 07:04:00 +0000 Original-Received: from localhost ([127.0.0.1]:45421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quSVD-0004Nb-O3 for submit@debbugs.gnu.org; Sun, 22 Oct 2023 03:04:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quSV9-0004NJ-5J for 66615@debbugs.gnu.org; Sun, 22 Oct 2023 03:03:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quSUb-0004XN-FJ; Sun, 22 Oct 2023 03:03:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=47Cq7nVuNMQKB172IrPX5cYmIADNtO07+NYM6GDgiN8=; b=lKnA5ZFdkoBnmOlIGv6W cfTD50+Jx4Q5Coxgq9ZlBQa9v60c2CfeatOS3rrE6MkGkQva/6quf54A9VSN5mjIocNQ3N1D6wEi5 amwrvJrujR7h9/1tcQjmdYmUfmYbUu+bTzzBQ1e4fmjAoKS0/0k9PBHoeje3uAVKYHItnOXyXQUVR JdljthXHp1nOgLuDbLWqZLdOLUVPfsH0UtFBekq5evzIfexU4iZsqFnkLvzunmCpSO/N8z/W6HMQd p8aQz7qFpfCUCAmhDxc4W1yht6uKk8Y/pqsaScqigRIBNPm68qwYkEcaTJGr10wwDyn9L3wUnhe6q xUgywyN+ZhJBOw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1quSUZ-000645-Ln; Sun, 22 Oct 2023 03:03:21 -0400 In-Reply-To: (Stefan Monnier's message of "Fri, 20 Oct 2023 16:51:54 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:272962 Archived-At: Stefan Monnier writes: >> (null boolean symbol list sequence atom) is not a linearization of the >> DAG, > > AFAIK it is. A linearization can be "depth first" or "breadth" first or > any mix of it. It's basically any total order compatible with the > partial order imposed by the DAG. > >> is just (TYPE . SUPERTYPES) where SUPERTYPES have no specific >> order. Am I wrong? > > The order is from most specific to least specific. For types which are > "incomparable", the choice is a judgment call. The above ordering seems > acceptable to me since `atom` is arguably a larger type than `sequence`, > but > > (null boolean symbol atom list sequence) > > is acceptable as well. > > This said, in general we'd like to avoid situations where type T1 > appears before type T2 in one case and after it in another (it may not > always be avoidable, sadly). And `atom` appears after `sequence` in > cases like `vector` and `string`, so I think we should prefer > > (null boolean symbol list sequence atom) > > over > > (null boolean symbol atom list sequence) > >> How can current code (say dispatch on builtin types) work if we can't >> infer if 'sequence' is higher or lower in the hierarchy respect >> to 'list'? > > The linearization is specific to a given type, so we use the ordering > provided by `cl--typeof-types` and we never care to know the full DAG. > > [ BTW, we should be able to infer that `list` is lower because every > time it appears in `cl--typeof-types` it is always followed by > `sequence`. ] > >> I think the original idea (as expressed by the doc) of having "the list >> of its supertypes from the most specific to least specific" works for >> reconstructing the DAG if we have one entry per path to the top, say: >> >> (null boolean symbol atom) >> (null list sequence) >> (cons list sequence) > > Indeed. But then it doesn't say how to make this into a total order > when `cl-defmethod` needs to decide which method should come first. > > IOW, there is supposedly a DAG, but until now we've never actually > needed the DAG itself, instead we've needed only a linearization of the > ancestors of the leaves of that DAG, which is what > `cl--typeof-types` stores. > > If you need the DAG, then maybe we need to store more info (tho I still > suspect we should be able to extract that info from `cl--typeof-types`). Yep, I think I'll go for adding the DAG somewhere else, extratcting it from `cl--typeof-types` doesn't look trivial at all (if even possible) and its definition is at this point kind of weak IMO for that. Thanks Andrea