unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: Rocky Bernstein <rocky@gnu.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Correct line/column numbers in byte compiler messages [Was: GNU is looking for Google Summer of Code Projects]
Date: Fri, 20 Mar 2020 17:30:47 -0400	[thread overview]
Message-ID: <jwvy2ruu41w.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20200320201005.GC5255@ACM> (Alan Mackenzie's message of "Fri, 20 Mar 2020 20:10:05 +0000")

>> I think fat-cons cells are cheap to implement (with (hopefully) no
>> performance impact when not used .....
> They may be cheap to implement in themselves, but adapting the entire
> byte compiler and all our macros to the heavily restricted semantics
> they would impose would be an enormous job.

The idea is that you want to make it work acceptably even if only some
of the cons-cells are fat.  This way, as you adapt the existing code to
pay attention/preserve fat-cons-cells, your location information gets
more and more precise, but even before you've done this enormous job,
you already get some of the benefit.

> I've tried something similar, and gave up in exhaustion.

If you want "exact" results, then you'll get tired long before getting
there, yes.  But it's not needed.

> Where does this 99.9% come from?  How is this cons tracking you're
> proposing supposed to work, when there are an infinite number of
> occurrences of the likes of
>
>     (cons (car form) (cdr form))
>
> in our code?

This still preserves info inside the fat-cons-cells contained in (car
form) and (cdr form), so it's not as bad as it looks.

Of course, when such code is applied recursively on all sub-expressions
(i.e. in a code-walker such as macroexpand-all, cconv, and byte-opt)
then we lose all the info, so we do need to change those before we can
benefit, but AFAICT those 3 are the only crucial ones (there are a few
other code-walkers around, such as generator.el) and hopefully some of
that rewrite can be made fairly mechanically.

> Are you saying that this is how other Lisp compilers deal with source
> code positions?  How do they deal with the difficult problem of user
> macros?

Not sure about Common-Lisp, but Scheme systems deal with it by
distinguishing "sexp" from "syntax objects" where syntax objects are
basically sexps wrapped (recursively) within location wrappers.

> I think there's quite a bit of doubt as to whether this could work
> effectively in Emacs.

I have no doubt that it can work.

I am not sure it'll be acceptable, OTOH, because it will depend on the
overhead it will impose on the execution of the byte-compiler.

> The way to dispel this doubt is for Somebody (tm) to implement it.

Exactly.

> To which the answer is to install the working solution pending the
> implementation of something better, after which it can be superseded.

Ever heard of temporary hacks that end up permanent?

Take for example the issue of .... oh, I don't know ... line numbers in
error messages?  ;-)

To a large extent the reason we don't have better line-numbers right now
is because of the hack we accepted some years ago, so now instead of
working on "giving line-numbers in error messages", we're reduced to
"improve the precision of line-numbers in error messages" which is not
nearly as pressing an issue.


        Stefan




      parent reply	other threads:[~2020-03-20 21:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 15:10 GNU is looking for Google Summer of Code Projects Rocky Bernstein
2020-03-19 17:35 ` Stefan Monnier
2020-03-19 17:56   ` Andrea Corallo
2020-03-19 18:05     ` Andrea Corallo
2020-03-19 18:19     ` Rocky Bernstein
2020-03-19 21:26     ` Stefan Monnier
2020-03-19 21:45       ` Andrea Corallo
2020-03-19 23:07         ` Rocky Bernstein
2020-03-19 20:34   ` Correct line/column numbers in byte compiler messages [Was: GNU is looking for Google Summer of Code Projects] Alan Mackenzie
2020-03-19 20:43     ` Andrea Corallo
2020-03-20 19:18       ` Alan Mackenzie
2020-03-21 11:22         ` Andrea Corallo
2020-03-21 15:30           ` Correct line/column numbers in byte compiler messages Alan Mackenzie
2020-03-21 16:28             ` Andrea Corallo
2020-03-21 18:37               ` Andrea Corallo
2020-03-21 20:19                 ` Alan Mackenzie
2020-03-21 21:08                   ` Andrea Corallo
2020-03-21 23:39                     ` Andrea Corallo
2020-03-22 11:26                   ` Alan Mackenzie
2020-03-19 20:56     ` Correct line/column numbers in byte compiler messages [Was: GNU is looking for Google Summer of Code Projects] Rocky Bernstein
2020-03-19 22:05       ` Stefan Monnier
2020-03-20 19:25       ` Alan Mackenzie
2020-03-19 21:41     ` Stefan Monnier
2020-03-19 22:09       ` Stefan Monnier
2020-03-20 20:10       ` Alan Mackenzie
2020-03-20 21:23         ` Rocky Bernstein
2020-03-20 21:27         ` Clément Pit-Claudel
2020-03-20 23:46           ` Stefan Monnier
2020-03-20 21:30         ` Stefan Monnier [this message]

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=jwvy2ruu41w.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=rocky@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 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).