[racket] TR - Syntax Entailing Syntax

From: Ray Racine (ray.racine at gmail.com)
Date: Mon Nov 5 13:58:22 EST 2012

Consider the innocuous appearing snippit below from
collects/racket/place/distributed/examples/hello-world.rkt

#lang typed/racket

(require racket/place/distributed
         racket/place)

(provide hello-world)

(: hello-world (-> Place))
(define (hello-world)
  (place ch
         (printf "hello-world received: ~a\n"
                 (place-channel-get (assert ch place-channel?)))
         (define HW "Hello World")
         (place-channel-put (assert ch place-channel?) (format "~a\n" HW))
         (printf "hello-world sent: ~a\n" HW)))


First issue is:
`place' is syntax entailing 2 closed over procs `place/proc' and
`start-place defined in racket/place.  No prob. I know the secret
incantation.

So I add a couple of strawman typings base-special-env.rkt and these
immediate undefined identifier errors magically go away.

 ;; from the expansion of `place'
  [(make-template-identifier 'place/proc 'racket/place)
   (-> -Variable-Reference -Symbol -Symbol (-> -Symbol
-Resolved-Module-Path -Symbol (-opt -Input-Port) (-opt -Output-Port) (-opt
-Output-Port) -Place)
       (-opt -Input-Port) (-opt -Output-Port) (-opt -Output-Port)
       -Place)]
  [(make-template-identifier 'start-place 'racket/place)
   (-> -Symbol -Resolved-Module-Path -Symbol (-opt -Input-Port) (-opt
-Output-Port) (-opt -Output-Port)
       -Place)]

The next one in the conga line is an unknown identifier error for `place?',
which _is_ publicly exported by racket/place.  But `place?' is itself
syntax, so I donno, we have some sort of require-syntax-for-syntax sort of
thing going on.

Just for laughs I tossed the below into base-special-env.rkt. and now
hello-world.rkt has errors on duplicate definition of `place?'.
 [(make-template-identifier 'place? 'racket/place)
   (-> Univ -Boolean)]

Any ideas on how move forward?  The idea was to take a run at TRing the
collects/racket/place/distributed/examples/hello-world.rkt

Thanks in advance,

Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121105/46ff3cd6/attachment.html>

Posted on the users mailing list.