Re: compile-time deserialization

2023-12-26 Thread Marc Feeley
> On Dec 26, 2023, at 3:07 PM, Al wrote: > > Hi, suppose I need to reference data from "file.txt" in my Scheme program. I > could use read-char / read / open-input-file etc (or other (chicken io) > procedures) to read the the contents of the file into a variable. > > However, such

Re: compile-time deserialization

2023-12-26 Thread Kristian Lein-Mathisen
Hi, You could try to put everything you're doing with read-string / read / open-input-file inside syntax. For example: ~/tmp> cat ./compile-time-io.scm (define file-contents (let-syntax ((load (er-macro-transformer (lambda (x r t) (import chicken.io

Re: compile-time deserialization

2023-12-26 Thread siiky via
Oh I forgot to mention you need an extra compiler flag to use it (-extend). And I also just remembered that I wrote a post about this at the time. (: https://siiky.srht.site/scheme/reader-syntax.html

Re: compile-time deserialization

2023-12-26 Thread siiky via
Hi, You can use reader syntax[0]. Take a look at this SQL reader syntax[1,2] I wrote some time ago for inspiration (it should require very little changing). [0] https://api.call-cc.org/5/doc/chicken/read-syntax/set-read-syntax%21 [1]