#1819 closed defect (fixed)

Add user-facing weak pairs API

Reported by: sjamaan Owned by:
Priority: major Milestone: 5.4
Component: core libraries Version: 5.3.0
Keywords: weak pairs, ephemerons, line numbers Cc:
Estimated difficulty: medium

Description

User "kluk" brought up on IRC that it would be nice to have line number information in the interpreter, for better error reporting. This is somewhat problematic because the interpreter has to deal with potentially unbounded input, as one can reload files interactively or have code be evaled at will.

Perhaps a relatively simple solution would be to use a weak hash table for the line number database.

Since we already *have* weak pairs in core, perhaps we should simply expose these to the user (and csi).

We could use this API from MIT Scheme:

https://web.mit.edu/scheme_v9.2/doc/mit-scheme-ref/Weak-Pairs.html

Also in Chez Scheme:

https://cisco.github.io/ChezScheme/csug9.5/smgmt.html#./smgmt:h2

Then this could form the basis of a weak hash table API as well. Perhaps best left as an internal API (just like other compiler hash tables are also internal). Later someone(TM) can provide an egg with a proper weak hash table API.

We should probably also look seriously into ephemerons (a la https://srfi.schemers.org/srfi-124/srfi-124.html), but from https://scheme-48.s48.narkive.com/YJq3GJOw/ephemerons-long-message-with-a-brief-preamble it seems these are somewhat trickier to implement, so that might be for a later version.

Change History (5)

comment:1 Changed 18 months ago by sjamaan

Milestone: someday5.5

comment:2 Changed 18 months ago by sjamaan

Ephemerons apparently have other problems in practice: https://github.com/cisco/ChezScheme/pull/189

I don't fully understand it, but wanted to include this link here anyway

comment:3 Changed 18 months ago by Mario Domenech Goulart

Milestone: 5.5

Milestone deleted

comment:4 Changed 18 months ago by sjamaan

Milestone: 6.0.0

comment:5 Changed 17 months ago by sjamaan

Milestone: 6.0.05.4
Resolution: fixed
Status: newclosed

Has been implemented and merged, and the locative table has now also been replaced with the same technique borrowed from MIT Scheme.

Line numbers are now available in the interpreter, too.

Note: See TracTickets for help on using tickets.