unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Warning on files byte-compiled with different versions
@ 2016-02-11 14:08 Phillip Lord
  2016-02-12 14:09 ` Phillip Lord
  0 siblings, 1 reply; 7+ messages in thread
From: Phillip Lord @ 2016-02-11 14:08 UTC (permalink / raw)
  To: emacs-devel



Does Emacs give a warning when loading .elc's created with a different
version?

I ask because I've seen a few problems recently which appear to be
caused by loading ELCs created with Emacs-25 in a Emacs-24.5 release.

Given that Emacs currently emits "compiled file is older than source
file" type warnings, this would seem to be a good thing to me.

Phil



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-11 14:08 Warning on files byte-compiled with different versions Phillip Lord
@ 2016-02-12 14:09 ` Phillip Lord
  2016-02-14 14:00   ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Phillip Lord @ 2016-02-12 14:09 UTC (permalink / raw)
  To: emacs-devel



So, the answer is no, AFAICT. Second question, is there any reason why
this kind of functionality could not be added?

Phil

Phillip Lord <phillip.lord@russet.org.uk> writes:

> Does Emacs give a warning when loading .elc's created with a different
> version?
>
> I ask because I've seen a few problems recently which appear to be
> caused by loading ELCs created with Emacs-25 in a Emacs-24.5 release.
>
> Given that Emacs currently emits "compiled file is older than source
> file" type warnings, this would seem to be a good thing to me.
>
> Phil



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-12 14:09 ` Phillip Lord
@ 2016-02-14 14:00   ` Stefan Monnier
  2016-02-14 15:02     ` Andreas Schwab
  2016-02-20  2:29     ` John Wiegley
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-02-14 14:00 UTC (permalink / raw)
  To: emacs-devel

> So, the answer is no, AFAICT. Second question, is there any reason why
> this kind of functionality could not be added?

Indeed.  The byte-compiler could simply emit

   `(if (< emacs-major-version ,emacs-major-version)
        (message "This file was compiled for a more recent Emacs"))

at the beginning of every file.  IIRC we used to do something like that.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-14 14:00   ` Stefan Monnier
@ 2016-02-14 15:02     ` Andreas Schwab
  2016-02-14 17:15       ` Stefan Monnier
  2016-02-20  2:29     ` John Wiegley
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2016-02-14 15:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> So, the answer is no, AFAICT. Second question, is there any reason why
>> this kind of functionality could not be added?
>
> Indeed.  The byte-compiler could simply emit
>
>    `(if (< emacs-major-version ,emacs-major-version)
>         (message "This file was compiled for a more recent Emacs"))
>
> at the beginning of every file.  IIRC we used to do something like that.

We have the bytecode version encoded in the header, and a check if it
contains multi-byte characters.  Just because the file was compiled by a
later version should not be a reason to prevent loading it, only if the
format itself changes.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-14 15:02     ` Andreas Schwab
@ 2016-02-14 17:15       ` Stefan Monnier
  2016-02-14 17:29         ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2016-02-14 17:15 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

> contains multi-byte characters.  Just because the file was compiled by a
> later version should not be a reason to prevent loading it, only if the
> format itself changes.

In practice, it's common to bump into problems for a file compiled with
a later version.  Usually it's because of macros, tho there are other
cases (e.g. the new bytecodes in 24.1 used for lexical-binding code, or
the new byte-codes (introduced in 24.4 and used since 25.1) used to
compile condition-case more efficiently in lexical-binding).

It's just much easier to say there's no forward compatibility, even if
it will sometime work fine.  Note also that we're talking
about signaling a warning, not an error.


        Stefan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-14 17:15       ` Stefan Monnier
@ 2016-02-14 17:29         ` Andreas Schwab
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2016-02-14 17:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

> cases (e.g. the new bytecodes in 24.1 used for lexical-binding code, or
> the new byte-codes (introduced in 24.4 and used since 25.1) used to
> compile condition-case more efficiently in lexical-binding).

New byte-codes is a format change.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Warning on files byte-compiled with different versions
  2016-02-14 14:00   ` Stefan Monnier
  2016-02-14 15:02     ` Andreas Schwab
@ 2016-02-20  2:29     ` John Wiegley
  1 sibling, 0 replies; 7+ messages in thread
From: John Wiegley @ 2016-02-20  2:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> So, the answer is no, AFAICT. Second question, is there any reason why this
>> kind of functionality could not be added?

> Indeed.  The byte-compiler could simply emit

>    `(if (< emacs-major-version ,emacs-major-version)
>         (message "This file was compiled for a more recent Emacs"))

> at the beginning of every file. IIRC we used to do something like that.

I'd personally appreciate having a warning like this, since it would let me
know that part of my environment is not built the way I thought it was.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-20  2:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-11 14:08 Warning on files byte-compiled with different versions Phillip Lord
2016-02-12 14:09 ` Phillip Lord
2016-02-14 14:00   ` Stefan Monnier
2016-02-14 15:02     ` Andreas Schwab
2016-02-14 17:15       ` Stefan Monnier
2016-02-14 17:29         ` Andreas Schwab
2016-02-20  2:29     ` John Wiegley

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).