[racket] TR requite/typed syntax error

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sun Oct 28 08:48:10 EDT 2012

On Sun, Oct 28, 2012 at 1:52 AM, Ray Racine <ray.racine at gmail.com> wrote:
> While the exact typing isn't quite right yet, the following added to the end
> of /collects/typed-racket/base-env/base-special-env.rkt is now giving normal
> TR type check (domain mismatch) errors.  So I assume I just need to get the
> signatures right.  This will put me past the show stopper problem of the
> quote-module-path closing over a protected procedure.
>   [(make-template-identifier 'module-path-fixup 'syntax/location)
>    (->opt [(Un -Symbol -String)] (Un -Path -Symbol (-lst (Un -Symbol
> -String))))]
>   [(make-template-identifier 'variable-reference->module-source/submod
> 'syntax/location)
>                              (-> -Variable-Reference
>                                  (Un (-pair (Un -Symbol (-val #f) -Path)
>                                             -Resolved-Module-Path)
>                                      -Symbol (-val #f) -Path))]

Yes, this is the general idea.

> But ...
> While module-path-fixup is an internal method,
> variable-reference->module-source/submod appears to be something that should
> be publicly exposed into the base environment given the treatement of its
> sibling methods.
> http://docs.racket-lang.org/reference/Namespaces.html?q=variable-reference#(def._((quote._~23~25kernel)._variable-reference-~3eempty-namespace))

I'm not sure if this should be exported -- it might just be a helper function.

> While the siblings seem to be runtime defined internal to Racket itself,
> variable-reference.../submod is defined as a regular Racket reference in
> syntax/location.  I tried exporting it and then injecting it into
> typed-racket/base-env/base-env.rkt through a number of tricks and treats -
> no go, its always an undefined identifier.  So I punted, and ended up just
> treating it strictly as a template identifier.  The above does solve my
> immediate issues of making progress on TRing Places.

If it isn't currently exported, you should use the
`make-template-identifier` mechanism -- that's what it's there for.

> Once I get the signature types right I'll submit a patch.

sam th
samth at ccs.neu.edu

Posted on the users mailing list.