unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: krisbalintona@gmail.com
Cc: emacs-devel@gnu.org
Subject: Re: Should vtable-goto-object use 'equal instead of 'eq?
Date: Sat, 16 Nov 2024 16:57:00 -0600	[thread overview]
Message-ID: <6265bdc3-9ba2-4e9e-a90d-2e87791066ef@alphapapa.net> (raw)
In-Reply-To: <CANVbq5kjPpCKwMBSYfHHLMFXAX7vAgy+D=uLAwJoTGQ5cLSjFQ@mail.gmail.com>

Hi Kristoffer,

> With these cases in mind, would it be best for vtable-goto-object to
> have as a parameter the predicate used by text-property-search-forward
> (the default being eq)?

Personally, I have no objection to making the predicate a parameter, if 
it's necessary to enable a real use case.

I would suggest that a concrete, real-world use case be presented before 
making such a change; I'm not sure if the example you gave is complete 
enough to be one.

AIUI Vtable is intended to present representations of a collection of 
objects.  Strings are objects, of course, and one can have multiple 
references to a string, which should facilitate comparison with EQ. 
Obviously, if a user inputs a new string that matches one in a 
collection, the two strings would not be EQ, but one could easily use, 
e.g. CL-FIND to locate the matching string and use it for 
VTABLE-GOTO-OBJECT.

As well, I could imagine circumstances in which there could be multiple 
objects in a collection which are EQUAL but not EQ.  Of course, you 
didn't suggest changing the default predicate, so that wouldn't be impacted.

Thinking about it further, making the predicate a parameter would allow 
one to pass a bespoke predicate that could do things like look inside 
objects and compare parts of them, which I could imagine being very 
useful.  (So maybe my suggestion about a concrete use case being 
required is too strong, haha.)

So, if no one else objects, I would be in favor of your suggestion being 
implemented.  It should be just a few lines of code and documentation, 
right?  If you submit a bug/patch, feel free to cc me on it.

--Adam



      reply	other threads:[~2024-11-16 22:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16 21:48 Should vtable-goto-object use 'equal instead of 'eq? Kristoffer Balintona
2024-11-16 22:57 ` Adam Porter [this message]

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=6265bdc3-9ba2-4e9e-a90d-2e87791066ef@alphapapa.net \
    --to=adam@alphapapa.net \
    --cc=emacs-devel@gnu.org \
    --cc=krisbalintona@gmail.com \
    /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).