cfinegan
2018-2-1 21:30:10

I’m looking to programatically get indentation info for use with a text% object. For this I’m looking into using read-language to get the determine-spaces procedure for a given language, but this doesn’t seem to work with #lang racket or #lang racket/base. For example, if I run the following code:

(define scrib-in (open-input-string "#lang scribble/base"))
(define scrib-info (read-language scrib-in))
(scrib-info 'drracket:indentation #f))

I get back #<procedure:determine-spaces>, which is exactly what I want. However, when I run the following similar code for #lang racket/base:

(define rkt-in (open-input-string "#lang racket/base"))
(define rkt-info (read-language rkt-in))
(rkt-info 'drracket:indentation #f)

I get back #f. I know that this is the intended behavior, i.e. when language-info returns false, then that means that the language is either racket or racket/base. But I’m wondering if there’s any way to work around this so I can get the procedures I need for the racket and racket/base languages. Is there a “default” version exposed somewhere that I can access in the case that language-info returns #f?


leif
2018-2-1 22:12:27

@lexi.lambda Did you change splicing-syntax-parameterize when you were adding splicing-parameterize?


lexi.lambda
2018-2-1 22:12:45

no, but I did change splicing-syntax-parameterize a month or two ago


leif
2018-2-1 22:12:54

Ah, okay.


leif
2018-2-1 22:13:13

Well I think it might have broken some of my code that used it.


leif
2018-2-1 22:13:28

Can you share with me the change you made?


lexi.lambda
2018-2-1 22:13:53

I made a couple of small changes… maybe open a bug on racket/racket and ping me


lexi.lambda
2018-2-1 22:14:07

preferably with a program that works on Racket 6.11 but not 6.12



ben
2018-2-1 22:14:37

lexi.lambda
2018-2-1 22:15:28

@ben’s commit is the first one, but it was largely superseded by https://github.com/racket/racket/commit/1e38918aa9719d212534d2027aa1a3a8b46462dd


lexi.lambda
2018-2-1 22:15:52

if you have a program that changed behavior, it would be very useful to add it as a test case to the splicing-syntax-parameterize test suite


leif
2018-2-1 22:16:22

Ya, I will do that as soon as I can make a minimal example.


leif
2018-2-1 22:16:35

It was…err…well, super complicated.


leif
2018-2-1 22:16:49

And kind of broke sets of scopes in very odd ways. :wink:


leif
2018-2-1 22:17:14

Anyway, thanks @ben and @lexi.lambda