
Okay, I have to ask what I think must be a silly question, but I cannot figure this out. Here is the documentation for read-string
:
I think that is the procedure that is defined in read/string.rkt, but the signatures do not match:
read-here-string)
(define (read-string in config #:mode [mode 'string])
What am I missing?

That’s not the right read-string
. The one you get from racket
right now is in “racket/src/racket/src/portfun.c”. The one you’ll get in the future from Racket-on-Chez is in “racket/src/io/port/string-input.rkt”.

I suppose the one in “expander/read/string.rkt” could have a different name to clarify that it’s the string case of the read
function.

Oh, I see my confusion. I was looking for the string case of the read
function. I rashly assumed that the documentation for read-string
should correspond to it.

In order to work on a Racket code file, is it necessary to build all of Racket?

notice the word “immediate” here https://docs.racket-lang.org/reference/stx-patterns.html#(form._((lib._racket%2Fprivate%2Fstxcase-scheme..rkt)._syntax%2Floc))

maybe try something like #`((s-if c (thunk #,(syntax/loc t t) (thunk #,(syntax/loc e e))))
that is, put the stx loc on the specific pieces of syntax inside the s-if
form, instead?

@alex has joined the channel

That unfortunately doesn’t help. Still get the same result :disappointed:

@paul it depends what file, really

Theres a good blog post on the Racket blog about this

The original syntax from your use of my-if
— for instance the identifier p
— does have the original source location. I see that in DrRacket macro stepper. And if there is an error, like (define p UNDEFINED)
, the error location is correct (e.g. line 14 not line 6). So: Is there a specific scenario where the srcloc of the macro-introduced let-values
actually matters?

Hmm. I’m writing a program to find a repair for a program and suggest it to users. It doesn’t make sense to analyze unexpanded code (which has all srclocs intact) since I have no idea what the semantics of a piece of syntax actually is. Hence I need to expand the code first. I hoped that all srclocs are intact after the expansion. Now I see that they aren’t…