[racket] Defining a typed language

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Mon Oct 27 04:43:26 EDT 2014

E. Moran writes:

 > Thanks for posting this...  I was just wondering if you've considered using the
 > datum->syntax trick, yet.

No, because this is the first time I hear about this!

First of all, your code works fine under Racket 6.1 as well, which is good.

Second, I don't quite understand how it works in detail, which is bad
- for me.  It looks like it does the equivalent of adding (require
a-typed-lang/more) at the beginning of each module that uses
a-typed-lang. That's what I expected my original code to do as
well. Your comment points to the difference, which is somehow related
to the lexical context in which the (require ...) is placed. However,
understanding why this makes a difference seems to require a clearer
idea of how "require" works than I currently have. Is this documented

 > It'd maybe not be the most elegant solution,
 > but it could at least serve to get things moving.

Indeed. I'll update my repository with your working code and a pointer
to this thread. Thanks a lot!

 >   (displayln (impersonator? foo))

A final question: after a quick look at the documentation for impersonators,
this looks like a check that foo is indeed the original function foo and
not something wrapped in a contract, right?


Posted on the users mailing list.