Hm, I have this two reads for a over and I didn’t quite get it. I thought every 
module was compiled in a fresh context so my issue is I’m wondering how that 
identifier for the box is defined for syntax expansion in untyped modules. 
Maybe you understand what I mean; otherwise I’ll give the paper a look later 
tonight or tomorrow to see what I’m missing here.

Thanks

> On Oct 7, 2020, at 8:44 PM, Sam Tobin-Hochstadt <[email protected]> wrote:
> 
> The way this works, the box doesn't have to "get into" any modules
> that aren't typed. Instead, when expanding a  module A, that module
> may contain uses of identifiers defined in a typed module T. Those
> identifiers are macros that look something like this:
> 
>    (define-syntax (id stx) (if typed-context? #'typed-id #'id-for-untyped))
> 
> Furthermore, the typed-context? value is initially set to #f, and it's
> set to #true only inside the typechecker. When `id` is used in an
> untyped module, it never gets set to #true, and so the
> `id-for-untyped` is used. That means that the untyped code doesn't
> need to know or do anything to make the system work, which is
> necessary for Typed Racket to be a library.
> 
> There's more detail about this in our Scheme Workshop paper, here:
> https://www2.ccs.neu.edu/racket/pubs/scheme2007-ctf.pdf
> 
> Sam
> 
> 
>> On Wed, Oct 7, 2020 at 6:18 AM Nate Griswold <[email protected]> wrote:
>> 
>> I just finished reading the paper "Languages as Libraries", which really 
>> helped as an introduction to racket's language system (i had previously been 
>> ignoring the syntax features).
>> 
>> I did have one question from it, which wasn't quite made clear in the 
>> interoperability section, or so it seems: how does the box `typed-context?` 
>> get into the modules that are not part of that language? Or more generally 
>> how would you solve this problem of needing to know which language of a 
>> module you are in without modifying the other languages? I was wondering if 
>> it was a hackaround or if there was a way to do generically in any language 
>> i might make.
>> 
>> I grepped the source code and it looks like it's even exposed to the user in 
>> a function `syntax-local-typed-context?`, but i noticed that module never 
>> actually imports `typed-context?`.
>> 
>> I suppose if it is a hack i could just reflect on the namespace to solve the 
>> problem, but i thought i would send a mail here to check.
>> 
>> Thanks for the great work everyone!
>> 
>> Nate
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-dev/CAM-xLPpey6e2S_JsBi_ZA_0OAC%2Bh8NJDrVYRv63fWmYrWiig1A%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/9B89FF3F-838B-45DD-B1A2-B35BCC873B3E%40gmail.com.

Reply via email to