Hi! I have a problem which I could not wrap my head around...
There is an error 'unbound identifier' in transform stage when I try to load some configuration with 'read-syntax'. This works at runtime stage.
What I try to do is get the syntax object for the symbols in the file, I need it to use srcloc (I am writing a small DSL for running tasks).
Here is a minimal code which shows the problem sample-loader.rkt · GitHub
sample-loader.rkt
#lang racket
(require (for-syntax racket))
(define-syntax (sample stx)
(syntax-case stx (file)
((_ (file path))
(let ((file (syntax->datum #'path)))
(call-with-input-string
(file->string file)
(lambda (port) (read-syntax file port)))))))
(sample (file "./sample.rkt"))
; ./sample.rkt::2: say-hello: unbound identifier;
; also, no #%app syntax transformer is bound
; at: say-hello
; in: (say-hello)
; Source locations:
; ./sample.rkt:1:0
sample.rkt
(say-hello)
The question is: how this could be fixed?
Thank you.