Opened 2 weeks ago

Last modified 2 weeks ago

#1581 new defect

record-instance? from (chicken memory representation) fails in modules

Reported by: kooda Owned by:
Priority: minor Milestone: 5.1
Component: core libraries Version: 5.0.0
Keywords: Cc:
Estimated difficulty: easy


Since 5.0.0, we prefix record symbols with the module name, this makes the behavior of record-instance? very strange, as the same call to it can work outside a module but fail inside.

For example, this breaks the record matching of the matchable egg.

Here is a test case:

(module foo ()
(import scheme)
  (chicken-4 (import chicken) (use lolevel))
  (chicken-5 (import (chicken base) (chicken memory representation))))
(define-record bar)
(assert (record-instance? (make-bar) 'bar)))

Change History (1)

comment:1 Changed 2 weeks ago by sjamaan

It seems to me we have several ways to do this.

We can document this, so that the user will know to pass in 'foo#bar as the record name.

We could also strip the prefix when comparing, so that any bar is accepted. That means it will also accept a bar from a completely different module, which might not be desirable (but it's more consistent with the pre-5 version).

Finally, we could make it syntax somehow (or add a syntax for getting a namespaced record name) and read out ##sys#current-module.

I prefer simply documenting the current behaviour, because (chicken memory representation) is a relatively low-level module already anyway.

Note: See TracTickets for help on using tickets.