Subject: Re: bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code

From: Eli Zaretskii <[email-masked]>
Date: Fri, 05 May 2023 14:33:03 +0300

> Date: Fri, 5 May 2023 18:20:09 +0700
> Cc: [email-masked], [email-masked], [email-masked],
>  [email-masked], [email-masked], [email-masked]
> From: Max Nikulin <[email-masked]>
> 
> On 05/05/2023 17:38, Eli Zaretskii wrote:
> >>> This doesn't work in Emacs, in general, due to circular dependencies.
> >>
> >> Could you, please, provide an example where circular dependencies are
> >> unavoidable or cost of disentangling of mutual dependencies is prohibitive?
> > 
> > What do you mean by "unavoidable"?
> 
> Ones that do not allow to apply approaches like:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62762#140

That's a huge message.  Which part of it specifically?

> Max Nikulin Fri, 5 May 2023 11:18:17 +0700
> > In the C and C++ world the solution for cyclic dependencies is forward 
> > declarations. Some kind of such approach I see in Org as well. 
> > lisp/org/ol.el and lisp/org/org-element.el are mutually dependent. 
> > org-element.el requires 'ol, while the latter just declares functions 
> > from 'org-element.

If it's this part, then I don't see how it can be relevant to our
case: our problem is to teach Make about these dependencies, not to
teach a Lisp compiler about them.  So forward declarations don't help
here, because Make doesn't have any such declarations, and it figures
out dependencies on its own, given only the prerequisites specified
for targets.

> On 05/05/2023 17:38, Eli Zaretskii wrote:
> >> My general impression that behavior of code having circular dependencies
> >> is harder to comprehend.
> > 
> > AFAIR, the problem is that we use 'require', eval-when-compile etc. to
> > get definitions of macros, functions, and variables.  There's nothing
> > difficult to comprehend in this.
> 
> I still have no idea which way it may be related to determining of order 
> of compilation based on dependency tree. That is why I asked for 
> particular examples.

I don't have ready examples off the top of my head, sorry.  You have
the Emacs Lisp sources, so you have all the information, and can find
those circular dependencies yourself if you don't believe me and
Stefan.