all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Martin Stjernholm <mast@lysator.liu.se>
Cc: Kenichi Handa <handa@m17n.org>, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: cc-vars.el
Date: 18 Nov 2002 23:15:06 +0100	[thread overview]
Message-ID: <5bbs4m8qz9.fsf@lister.roxen.com> (raw)
In-Reply-To: <rzqr8di8xlx.fsf@albion.dl.ac.uk>

Dave Love <d.love@dl.ac.uk> wrote:

> /.../ There are typically still some compilation warnings if you do
> portability stuff cleanly, but they're not usually excessive.

I consider anything more than two warnings all-in-all to be too
excessive. After that it's too easy to get accustomed to them and stop
looking carefully enough.

> I see a comment in cc-bytecomp implying that compilation is supposed
> to produce byte code that's portable between Emacs and XEmacs, but
> that's a lost cause.

True, but it's more valid within different versions of the same
branch, e.g. between Emacs 20 and 21, and even more so between minor
versions. I had at one point a simple macro system that tested all
this at compile time and made completely tailored byte code, and I got
a complaint from a user then. I don't remember between what exact
versions he tried to port it, but a single complaint isn't much of
test data anyway. From it I can only draw the conclusion that the
problem exists, not at all how big or small it is.

The only way to avoid compiler warnings cleanly (in some sense) is to
do the tests with macros at compile time, but that is apparently not a
good solution. Thus, the only resort is to make these kludgy symbol
and variable bindings.

> /.../ Changes to the compiler would help, e.g. to avoid warnings
> from
> 
>  (unless (fboundp 'fred)
>    (define fred ...))

It's possible to do something like this without any compiler warnings
at all; that's essentially what cc-bytecomp-defun does (and now it
hopefully does it correctly too). The problem is not there but rather
that it's necessary to actually bind the symbols to get rid of the
warnings since there is no other way to hook into the compiler to
control them.

> A change for that I once suggested greatly reduced the noise and I
> don't think it's a big issue to re-write a few things to forms such a
> compiler check would be documented to recognize.

Don't you rather mean code like this?

    (if (fboundp 'fred)
        (fred ...))

It'd be cool if the compiler did enough flow analysis to cope with
that, but it might be hard to get it to work well, and if it doesn't
work well then I'd prefer to have the possibility to control the
warnings explicitly with some pragma-like system.

It's really the lack of such a system in the byte compiler that is the
problem here.

An interesting angle is if something like the following can be used
(although I'd consider this too a workaround rather than a solution):

    (if (boundp 'fido)
        (symbol-value 'fido))
    (if (fboundp 'fred)
        (funcall 'fred ...))

Someone with insight in the inner workings of the compiler can perhaps
advice on how effectively it manages to optimize such things.

> I also think it's unwise to try to support ancient versions of
> (X)Emacs.  That just makes life difficult and takes resources that
> could be put into improvements for current versions, especially taking
> advantage of new features.

That is a valid point to some extent, but it's a choice I prefer to
make myself when it comes to my own "upstream" development CC Mode. I
approach it this way: If there's some _specific_ feature in newer
emacsen that would give a real benefit, and if I think it's too hard
to implement compatibility kludges for it, then and only then do I
scrap compatibility. (Thus I don't consider an argument that a kludge
just looks big and ugly as a valid reason for dropping it.)

Anyway, this is besides the point regarding cc-bytecomp, since that
one is necessary to keep it working and compiling without warnings on
both Emacs and XEmacs. It's actually the support for both flavors that
is responsible for approximately 90% of all the time I spend on
compatibility kludges. It also means I can't use a new feature until
it's so old that it exist in the other flavor, in at least an
approximately similar form. (Such a feature is the syntax-table text
property, which I intend to make greater use of and which will be the
specific reason that CC Mode soon will ditch support for Emacs 19 and
XEmacs 19 and 20.)

As for the distribution in Emacs I don't really have any objections if
someone decides to rip out all the compatibility code, except for one
thing: The ripping-out itself is a possible source of errors, and I
wouldn't like to have to spend time on hunting down bugs due to that
which gets reported to me.

  reply	other threads:[~2002-11-18 22:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E18CrrF-0005AT-00@fencepost.gnu.org>
     [not found] ` <rzqwunberel.fsf@albion.dl.ac.uk>
2002-11-18  0:57   ` cc-vars.el Kenichi Handa
2002-11-18 19:09     ` cc-vars.el Richard Stallman
2002-11-18 19:51     ` cc-vars.el Dave Love
2002-11-18 22:15       ` Martin Stjernholm [this message]
2002-11-19  1:40         ` cc-vars.el Miles Bader
2002-11-19 15:45           ` cc-vars.el Martin Stjernholm
2002-11-19 16:57             ` cc-vars.el Miles Bader
2002-11-19 21:58               ` cc-vars.el Martin Stjernholm
2002-11-20  2:22                 ` cc-vars.el Miles Bader
2002-11-20 13:58                   ` cc-vars.el Stefan Monnier
2002-11-20 15:43                     ` cc-vars.el Kim F. Storm
2002-11-20 15:01                       ` cc-vars.el Stefan Monnier
2002-11-20 16:37                         ` cc-vars.el Kim F. Storm
2002-11-24 19:32                           ` cc-vars.el Dave Love
2002-11-24 19:30                         ` cc-vars.el Dave Love
2002-11-20 21:29                     ` cc-vars.el Miles Bader
2002-11-20 21:44                       ` cc-vars.el Stefan Monnier
2002-11-22  1:51                       ` cc-vars.el Martin Stjernholm
2002-11-21 17:12                     ` cc-vars.el Richard Stallman
2002-11-21 18:55                       ` cc-vars.el Stefan Monnier
2002-11-22  2:00                         ` cc-vars.el Martin Stjernholm
2002-11-20 16:40                 ` cc-vars.el Dave Love
2002-11-20 16:35             ` cc-vars.el Dave Love
2002-11-19 16:59           ` cc-vars.el Dave Love
2002-11-20 21:14             ` cc-vars.el Richard Stallman
2002-11-24 19:33               ` cc-vars.el Dave Love
2002-11-20 21:41             ` cc-vars.el Miles Bader
2002-11-24 19:36               ` cc-vars.el Dave Love
2002-11-19  7:49         ` cc-vars.el Kai Großjohann
2002-11-19 16:55         ` cc-vars.el Dave Love
2002-11-19 20:35           ` cc-vars.el Martin Stjernholm
2002-11-20  9:46             ` cc-vars.el Kai Großjohann
2002-11-21 17:12               ` cc-vars.el Richard Stallman
2002-11-20 16:38             ` cc-vars.el Dave Love
2002-11-18 22:17       ` cc-vars.el Stefan Monnier
2002-11-19 17:01         ` cc-vars.el Dave Love

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bbs4m8qz9.fsf@lister.roxen.com \
    --to=mast@lysator.liu.se \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.org \
    --cc=rms@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.