From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <20200319203449.GA4180@ACM> <20200320201005.GC5255@ACM> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58451"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Rocky Bernstein , emacs-devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 20 22:31:30 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jFPEo-000F6L-06 for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Mar 2020 22:31:30 +0100 Original-Received: from localhost ([::1]:59416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFPEm-0005sp-W9 for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Mar 2020 17:31:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44991) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFPEC-0005DN-LY for emacs-devel@gnu.org; Fri, 20 Mar 2020 17:30:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFPEB-0002kh-43 for emacs-devel@gnu.org; Fri, 20 Mar 2020 17:30:52 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45149) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jFPEA-0002kN-TN; Fri, 20 Mar 2020 17:30:51 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AFF2144F69D; Fri, 20 Mar 2020 17:30:49 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D1C5144F690; Fri, 20 Mar 2020 17:30:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1584739847; bh=F6+FM3Pea7t4PY4mh6Mz24tjfCnwe5Dz8KOm+B2+jn8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Lqg+P2gbwGm8DaTUKAMm5srvnPXamW/1UmJlNlD6j5Aryqxd29P/KgyueaftxKInN Oec2gB5g+QaKozE6pd4Z+Reqp0ytEynR3SAq94o9jwL8/fQ9/9dkGXLZzMCzGi5wW+ aVuxRhvxOvil0HGsXQMWQwuuV4hcSrnyhC7Hkxsu4bEzciK9S8ZdVL9TYEhO7f2plT 6aze5qvZQrRQo7lS8elZsjQ8Wx5vr7EqnZmyKFLLO2y9Q0C97WzBCE2XcmVT6zZSoD QzWwM8qgsmUBdgIRTp4GsDXTS5WfKi2DBEKoI8gOMGP/q8QssCGlxVialRNKoHSM91 ATamxMfWAAmlw== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BCDE9120795; Fri, 20 Mar 2020 17:30:47 -0400 (EDT) In-Reply-To: <20200320201005.GC5255@ACM> (Alan Mackenzie's message of "Fri, 20 Mar 2020 20:10:05 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245615 Archived-At: >> 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