l...@gnu.org (Ludovic Courtès) writes: > Hi Andreas, > > Andreas Rottmann <a.rottm...@gmx.at> writes: > >> The expansion of `define-inlinable' contained an expression, which made >> SRFI-9's `define-record-type' fail in non-toplevel contexts ("definition >> used in expression context"). > > SRFI-9 says “Record-type definitions may only occur at top-level”, and > I’m inclined to stick to it. If we diverge, then people could write > code thinking it’s portable SRFI-9 code while it’s not. > I can certainly relate to that, and agree that it's a good principle, however, see below.
> How about adding a ‘let-record-type’ or similar in (srfi srfi-9 gnu)? > The issue is not that I'm explictly writing code that uses `define-record-type' in a non-toplevel context, but that I have a testing framework (built upon Riastradh's trc-testing), which uses R6RS `eval' to load testcases. Since `eval' does not allow for the code to be evaluated to be in a top-level context, I'm using this: (eval `(let () ,@code-to-be-tested) the-environment-for-the-code) Now `code-to-be-tested' can't contain any SRFI-9 record definitions if the literal interpretation of SRFI-9 is used, even if that code would run perfectly fine if entered at the REPL or being executed as an R6RS script (modulo the import statement, but the test runner can work around that). This is certainly a special use case, but I think it is reasonable one. Regards, Rotty -- Andreas Rottmann -- <http://rotty.yi.org/>