[racket] language-info in #lang typed/racket files vs. (module _ typed/racket ...) files
The contract profiler has to solve a similar problem, to distinguish
typed and untyped modules in its module view.
ISTR attempting to use `module->language-info`, unsuccessfully. I forget
what went wrong.
Instead, it checks for the presence of a `#%type-decl` submodule which,
by convention, only appears in typed modules.
Vincent
At Mon, 24 Nov 2014 15:59:14 -0500 (EST),
Daniel Feltey wrote:
>
> I'm trying to use `module->language-info` to determine if a module I am requiring is written in typed/racket or racket, since if the module is implemented in racket `module->language-info` will return #f, but a vector if the module was typed.
>
> The problem I'm running into is that with files of the form:
>
> ;; foo.rkt
> (module foo typed/racket
> ...)
>
> (module->language-info "foo.rkt" #t) returns #f even though I expect a language-info that tells me the file is written in typed/racket.
>
> Changing foo.rkt to the following:
>
> ;; foo.rkt
> #lang typed/racket
> ...
>
> Then gives a non-false language-info vector when calling (module->language-info "foo.rkt" #t).
>
> Is this the expected behavior? I thought that the #lang version of the file should be equivalent to the (module ...) version.
>
> This seems to be addressed somewhat in http://docs.racket-lang.org/guide/module-runtime-config.html but it doesn't explain why (module ...) doesn't get language-info.
>
>
> Thanks
> Dan
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users