From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#69709: `sort` interface improvement and universal ordering predicate Date: Fri, 17 May 2024 19:49:48 +0200 Message-ID: <2E77A445-7696-428E-A22C-28C47FCB192B@gmail.com> References: <86zfv6uqjn.fsf@gnu.org> <4391448A-C7AF-4D7F-8866-C0313956D52D@gmail.com> <8366111E-97C4-4839-AA1E-A577C81A6035@gmail.com> <4B7ACA81-DEB9-4878-BE0B-88A302AF7081@gmail.com> <2BB79019-C075-445C-A9E0-9D29929EA02A@gmail.com> <7219B5AB-4EA7-4050-92AE-7FB949D6D415@gmail.com> <87edbtnu8i.fsf@daniel-mendler.de> <46794723-8324-41DD-8A1F-C1206A8EAFC2@gmail.com> <87le48d3kd.fsf@daniel-mendler.de> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20558"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69709@debbugs.gnu.org, ~pkal/compat-devel@lists.sr.ht, Gerd =?UTF-8?Q?M=C3=B6llmann?= , Dmitry Gutov , Stefan Monnier , Eli Zaretskii To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 17 19:52:22 2024 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 1s81kk-0005As-0P for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 17 May 2024 19:52:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s81kQ-0001lV-LM; Fri, 17 May 2024 13:52:02 -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 1s81kN-0001lF-Cs for bug-gnu-emacs@gnu.org; Fri, 17 May 2024 13:52:00 -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 1s81kN-000327-4A for bug-gnu-emacs@gnu.org; Fri, 17 May 2024 13:51:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s81kP-0007TB-RI for bug-gnu-emacs@gnu.org; Fri, 17 May 2024 13:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 May 2024 17:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69709 X-GNU-PR-Package: emacs Original-Received: via spool by 69709-submit@debbugs.gnu.org id=B69709.171596826128677 (code B ref 69709); Fri, 17 May 2024 17:52:01 +0000 Original-Received: (at 69709) by debbugs.gnu.org; 17 May 2024 17:51:01 +0000 Original-Received: from localhost ([127.0.0.1]:56428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s81jR-0007SP-2k for submit@debbugs.gnu.org; Fri, 17 May 2024 13:51:01 -0400 Original-Received: from mail-lj1-f180.google.com ([209.85.208.180]:54621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s81jP-0007SJ-A5 for 69709@debbugs.gnu.org; Fri, 17 May 2024 13:51:00 -0400 Original-Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2e564cad1f6so30279871fa.1 for <69709@debbugs.gnu.org>; Fri, 17 May 2024 10:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715968190; x=1716572990; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=De6xnrnJDYGV7rovHhavN4ZyQT60ljvRHpy4wEBTY3I=; b=c9G4Dn3yoOx0qb3G+LI6mU50DIiL+tXYmaQjJCvPuitPS9HlVgUsSpwDYQcptc2C4e EhMyQVhIGwH+UIbaINCwhfXr8oSL3vjb/nVmjhY5sVVR9x1hV66+L4CMFyTjxcGqImEw LN3CU10bIjPORpked66FInRjyVvN1N9+mF/Mtz/gA52ui+sXj2GihWFU4ruGOrbnioCl wYcWEQF6k2U8jqQUToMQgA7QPXaDlm1vBHbS7HTN+9jZbntj4nXj3a4s7xMCogf5W096 Gpu8Qf/WFUJKmOPjvBYTuarraWCVQ4+lq5XExAq07LOI/6Fh1LO8e+qSZavFJSR7/paD OsXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715968190; x=1716572990; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=De6xnrnJDYGV7rovHhavN4ZyQT60ljvRHpy4wEBTY3I=; b=PVahQ+B6QCzELAoLdRlVvWWrdZnGXaArpwYh8z1GKEpIAXycj5vtDsPQG3QYxu+RqV jmUWJMrQfpR1lWeKr4CBPs4cL2FvVjcoLKgZsKjXX1tIXE7B11ruhj8wAW8oGg1htemJ x/WMdzPmUEftQZnpqCeiQee2MHFrWEfT1qHmtySOpMzU6l1A1lFOBwQ8vkdgSNLAn35l MRtbXnaBvtUyg7BCZDwf+swgtkKrvUXaAgXkIqIYXIGUiK7v/xPvrVeCGQeplBrNTI9Q TY/EC4j+mW5yk2DkJiM5c7RHwRPMd/DEQ9JW8vWuyw6onH1KiHvMHMz9bKXAp9qhcviY CF2Q== X-Forwarded-Encrypted: i=1; AJvYcCXTIXiDcWMNLVtKIgGBAKEfqZXuRqgRMmSI+QHLQ4+Jz8g1GmMYLuH01tW7WHiLH+Tv4rzSUNiZvfzqKusovtQ0nJjVLZ8= X-Gm-Message-State: AOJu0Yy2jCV7sFt+QLCyfN0yw0q/TsYGEr53wPuk1lMkN+o9hU8Opnc3 Uc7Ge5XWzcPGWjsmy7AVAEzrYg9TO00S6RXv0mdZNzHdaOaHD9y1 X-Google-Smtp-Source: AGHT+IFw6BUlxUVpTs0wFsNcqQTC2wWGavzfdX9QGTz/mdGk6koGisc49KSTi6Q88AvWeWFtiwvGzg== X-Received: by 2002:a2e:9045:0:b0:2e3:38e0:54c7 with SMTP id 38308e7fff4ca-2e5204b2f26mr146736141fa.38.1715968189994; Fri, 17 May 2024 10:49:49 -0700 (PDT) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2e4d0bbcc28sm26600531fa.11.2024.05.17.10.49.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2024 10:49:49 -0700 (PDT) In-Reply-To: <87le48d3kd.fsf@daniel-mendler.de> X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:285261 Archived-At: 17 maj 2024 kl. 14.29 skrev Daniel Mendler : > Just letting you know that I've implemented value< and sort in the > emacs-30 branch of Compat. It works well so far, but value< is not yet > completely implemented. See the following commit: > = https://github.com/emacs-compat/compat/commit/8190769d9eb9258dd8361bd322d9= 0228dc586770 An excellent start! I'll post comments on the source site. > There is one thing I'd like to ask about value<. Would it make sense = to > support comparing mixed types, e.g., numbers and markers or strings = and > symbols? I went back and forth quite a bit, but decided to start small = homogeneous comparisons which would at least give the option to extend = to heterogeneous (or in your case, ad-hoc mixed) comparisons later on, = without committing too much to any particular design until we have more = experience. When it comes to mixing numbers and markers, I'm still leaning against = it. `<` allows mixed comparisons but it doesn't work well with markers = from different buffers. `value<` orders markers by grouping them by = buffer which feels more useful. (I've never been a great fan of the way elisp allows comparison and = arithmetic on markers and numbers; it probably seemed to be a good idea = at the time. That feature seems to have caused more muddled than clear = code.) Same with strings and symbols: I can't remember having seen a collection = where I would have wanted them to be sorted together, and `nil` being a = symbol means that we would lose a useful error check. There is a more tempting case for a truly heterogeneous comparisons, = like a universal total order. Some other languages have this but I think = it is more difficult to construct with so much legacy. I went with = unifying all numbers for pragmatic reasons even though -0.0 and NaN are = terrible.