[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: stack traces with line numbers
From: |
Helmut Eller |
Subject: |
Re: Proposal: stack traces with line numbers |
Date: |
Tue, 17 Oct 2017 02:00:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
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
- Proposal: stack traces with line numbers, John Williams, 2017/10/14
- Re: Proposal: stack traces with line numbers, Daniele Nicolodi, 2017/10/14
- Re: Proposal: stack traces with line numbers, raman, 2017/10/14
- Re: Proposal: stack traces with line numbers, Robert Weiner, 2017/10/14
- Re: Proposal: stack traces with line numbers, Helmut Eller, 2017/10/15
- Re: Proposal: stack traces with line numbers, Richard Stallman, 2017/10/15
- Re: Proposal: stack traces with line numbers, Wilfred Hughes, 2017/10/16