paul
2018-10-22 18:59:17

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:

https://docs.racket-lang.org/reference/Byte_and_String_Input.html?q=read-string#%28def._%28%28quote._~23~25kernel%29._read-string%21%29%29

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?


mflatt
2018-10-22 19:02:07

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”.


mflatt
2018-10-22 19:03:33

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.


paul
2018-10-22 19:27:51

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.


paul
2018-10-22 22:53:19

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



greg
2018-10-22 23:39:23

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
2018-10-23 00:41:16

@alex has joined the channel


sorawee
2018-10-23 00:54:49

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


samth
2018-10-23 02:04:42

@paul it depends what file, really


samth
2018-10-23 02:05:11

Theres a good blog post on the Racket blog about this


greg
2018-10-23 03:39:17

The original syntax from your use of my-if — for instance the identifier pdoes 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?


sorawee
2018-10-23 04:51:51

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…