Search code examples
schemechicken-scheme

How to load Chicken Scheme files that contain #><# sharp-sign read syntax?


I can use most sharp-sign read macros at the repl, or in a file loaded using (load):

#;1> #${ abcdef }
#${abcdef}

But I can't use the foreign declare syntax #> <#:

#;1> #>#include "md5-base.c"<#
Error: invalid sharp-sign read syntax: #\>

Granted, there's probably no reason to use it at the repl, but I'm trying to write a program that (load)s other sources at run-time and introspects them, and it's falling over when it hits the syntax:

(load "/tmp/temp29fe.31217/md5/md5.scm")
; loading /tmp/temp29fe.31217/md5/md5.scm ...

Error: (line 11) invalid sharp-sign read syntax: #\>

        Call history:

        <syntax>          (load "/tmp/temp29fe.31217/md5/md5.scm")
        <eval>    (load "/tmp/temp29fe.31217/md5/md5.scm")      <--

How can I (load) a file containing #> sharp-syntax?


Solution

  • That syntax is only supported in the compiler; it makes no sense to use it in evaluated code. If you're only interested in using read on it, you can probably get away with defining your own override using set-sharp-read-syntax!.