unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp <p.stephani2@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 47799@debbugs.gnu.org
Subject: bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames
Date: Sun, 5 Sep 2021 19:14:29 +0200	[thread overview]
Message-ID: <D53D6A6C-635B-49F2-A2CB-F56D9D469727@gmail.com> (raw)
In-Reply-To: <bd5e5e2d-1d2f-53e4-febc-3600013584e3@yandex.ru>



> Am 18.07.2021 um 02:53 schrieb Dmitry Gutov <dgutov@yandex.ru>:
> 
> On 05.07.2021 22:05, Philipp wrote:
> 
>>> The difficulty is having a method like project-files return one format for some users, and another for users who want to take advantage of this performance improvement. Or we break the compatibility and/or introduce a new method with this new behavior.
>> A general design approach in OOP is to not treat abstract virtual functions (generic functions in ELisp terminology) as part of the public interface of a type; i.e., abstract functions can be implemented, but shouldn't be called outside of the module that defines them (project.el in this case).  That allows for changes like this: implementers could freely return the new fileset structure because only project.el would call project-files.  Not sure how much ELisp code adheres to this principle, though.  
> 
> When you say "abstract virtual functions", do you mean OOP as in C++ OOP? I'm not sure about standard practices there, but this sounds more like C++ and less like OOP in general.
> 
> I'm looking as generic functions here as part of an interface signature (like Java or Go interface). They are programmed against (which is the case with project.el) and are supposed to be stable.

I think the idea is applicable to most programming languages that have some form of subtype polymorphism.  Basically, for a normal (monomorphic) function, you can make the parameter types more general or the return type over time more specific over time without breaking compatibility.  For a polymorphic function that's only specialized but not called outside the defining entity, e.g. a private virtual function in C++ or a method marked as @ForOverride (https://github.com/google/error-prone/blob/master/annotations/src/main/java/com/google/errorprone/annotations/ForOverride.java) in Java, it's the other way round: you can make the parameter types more specific and the return type more generic over time.  That implies that for a polymorphic function that's also called outside the defining entity, you can't change any of the types without breaking compatibility.  Thus the suggestion to separate the interface for callers from the interface for subclasses/specializers.

> 
> > If there's too much code (outside of project.el) that relies on project-files returning a list, we need to indeed fall back to some of the other options.
> 
> A new method seems to be the way forward. Or, say, an ad-hoc argument which determines whether file names should be relative.

I guess you also can't introduce new parameters without breaking compatibility either.  That would only leave the new method possibility.  We could then say that nothing outside project.el should call it to avoid the above problem.  Ideally, the byte compiler would support a declaration form similar to @ForOverride to warn about such invocations.






  reply	other threads:[~2021-09-05 17:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 13:43 bug#47799: 28.0.50; Default `project-files' implementation doesn't work with quoted filenames Philipp Stephani
2021-04-15 16:15 ` Dmitry Gutov
2021-04-15 16:26   ` Philipp Stephani
2021-04-15 16:44   ` Philipp Stephani
2021-04-16  1:08     ` Dmitry Gutov
2021-04-18 20:06       ` Philipp Stephani
2021-04-18 20:21         ` Dmitry Gutov
2021-04-19 14:48           ` Philipp Stephani
2021-04-19 20:48             ` Dmitry Gutov
2021-04-22  0:46               ` Dmitry Gutov
2021-05-16 13:37               ` Philipp
2021-05-16 23:22                 ` Dmitry Gutov
2021-05-16 23:31                   ` Dmitry Gutov
2021-07-05 19:05                   ` Philipp
2021-07-18  0:53                     ` Dmitry Gutov
2021-09-05 17:14                       ` Philipp [this message]
2021-09-20 16:05                         ` Dmitry Gutov

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=D53D6A6C-635B-49F2-A2CB-F56D9D469727@gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=47799@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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).