all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Re: Thoughts on the buffer positions in the byte compiler's warning messages.
Date: Sun, 18 Sep 2016 17:38:51 +0000	[thread overview]
Message-ID: <20160918173851.GB3576@acm.fritz.box> (raw)
In-Reply-To: <20160918152303.GA3576@acm.fritz.box>

Hello, Emacs.

On Sun, Sep 18, 2016 at 03:23:03PM +0000, Alan Mackenzie wrote:
> ######################################################################### 

> I've been trying to come up with a general solution to these problems.
> What I have at the moment, which is rather vague, amounts to this:

> After the reader has produced the form to be compiled and
> read-symbol-positions-list, we combine these to produce a @dfn{shadow
> form} with the same shape as the form, but where there's a symbol in the
> form, there is a corresponding list in the shadow form, noting the
> corresponding "position" in the form, and onto which warning/error
> messages can be pushed.  These can then be output at the end of the
> compilation.

> The info in the shadow form will allow the correct node corresponding to
> one in the form to be found, thus correct line/column numbers in
> messages are assured for normal code.  Possibly a hash table will serve
> somehow to speed up searches.

> For transformed code (macro invocations, optimised forms, etc.), things
> become more difficult.  However, these transformations mostly leave most
> of the cons cells in the form unchanged, just rearranging them somewhat.
> So the "pointers" in the shadow form will continue to be associated with
> them, enabling accurate warning messages even here.

> Obviously, this mechanism would cause the byte compiler to run more
> slowly.  Whether or not this is significant or not would be down to
> experience.

> Comments?

Actually, with a bit more thought, the above is totally over the top.

What's needed is to construct a hash table whose key is a cons cell in
the form which the reader has just built, and whose value is the
position of the symbol in the car of that cons cell.  OK, something is
needed for vectors, too, and maybe one or two other things.

This hash table can easily be built from the available information (the
form and read-symbol-positions-list), and once the mechanism is seen to
be working we could get the reader to produce this hash table directly.

Then when we want to output a diagnostic, in addition to passing the
string to byte-compile-warn, we also pass a cons cell representing the
position we want output.

This should work.

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2016-09-18 17:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18 15:23 Thoughts on the buffer positions in the byte compiler's warning messages Alan Mackenzie
2016-09-18 17:38 ` Alan Mackenzie [this message]
2016-10-13 22:58   ` Andreas Politz
2016-09-18 18:21 ` Helmut Eller

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=20160918173851.GB3576@acm.fritz.box \
    --to=acm@muc.de \
    --cc=emacs-devel@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.