From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Proposal: stack traces with line numbers Date: Tue, 17 Oct 2017 02:00:14 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1508198491 18090 195.159.176.226 (17 Oct 2017 00:01:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 17 Oct 2017 00:01:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 17 02:01:27 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4FJz-0003nw-Vs for ged-emacs-devel@m.gmane.org; Tue, 17 Oct 2017 02:01:24 +0200 Original-Received: from localhost ([::1]:35678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4FK7-0002uD-CP for ged-emacs-devel@m.gmane.org; Mon, 16 Oct 2017 20:01:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4FJS-0002tw-Iv for emacs-devel@gnu.org; Mon, 16 Oct 2017 20:00:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4FJN-0006Xv-Ou for emacs-devel@gnu.org; Mon, 16 Oct 2017 20:00:50 -0400 Original-Received: from [195.159.176.226] (port=44776 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4FJN-0006XI-Hk for emacs-devel@gnu.org; Mon, 16 Oct 2017 20:00:45 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1e4FJ1-0004rG-L4 for emacs-devel@gnu.org; Tue, 17 Oct 2017 02:00:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:GfNxt/SDA1cIYYq6b0udL7fcZYc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219596 Archived-At: On Mon, Oct 16 2017, John Williams wrote: > What I had in mind was a single global hashtable, because that way > it's easy to make it look as if the source refs are physically part of > the annotated cons cells, and users of the API don't need to be aware > that a supplementary data structure even exists. But of course using a > global hashtable with strong keys would create a huge space leak in > the reader. > > Is there any particular disadvantage to using weak keys? The question is probably more if a global hashtable is a good idea. I think an interface to read, like (let* ((read-with-symbol-positions t) (read-symbol-positions-list '()) (read-cons-position-table (make-hash-table :key 'eq)) (form (read ...)) ... do stuff with form ...) would be fairly clean. Actually, it's quite hard to imagine a different solution :-). So users of read will probably have the choice anyway whether to bind read-cons-position-table (or whatever the name will be) to a fresh hashtable or reuse a global table. > The file name would be a single string object shared by every ref in a > given file (or nil when there is no file), so we'd only be saving a > few words per source ref (one for the string itself, plus one or two > saved by using a cons cell instead of a two-element vector.) For the interface to read (the macro expander/compiler is a different story) I would only record character positions. Certainly easier to handle for the garbage collector than a vector. But it's not my call to make. Helmut