[racket] TR - Syntax Entailing Syntax

From: Ray Racine (ray.racine at gmail.com)
Date: Mon Nov 5 15:14:52 EST 2012

OK, so it is a little bit of red herring on the unbound identifer `place?',
i.e. there is an unexported identifier(s) in the expansion of `place?'
which is the true issue.   For what it's worth is yet another level of
syntax explosion below `place?'.  But if I get the full explosion graph of
these these internal procedures situated into base-special-env.rkt it will
all clear up is what I'm taking away.  A quick glance leads me to believe
it is less than a dozen, which means doable in finite time.

Time to saddle up and start charging them windmills.

Thanks,


On Mon, Nov 5, 2012 at 2:50 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu>wrote:

> On Mon, Nov 5, 2012 at 1:58 PM, Ray Racine <ray.racine at gmail.com> wrote:
> > 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)]
>
> If `place?` is indeed exported by `racket/place`, then the above won't
> work.  You'll need to give a type to the internal identifier that
> `place?` expands into.
>
> However, looking at the expansion of the hello-world.rkt program, it
> doesn't seem to contain `place?`.  So I'm confused as to where that's
> coming from.
>
> Finally, the way the `place` form works means that it would be better
> to give a type annotation to `ch` using the #{ch : Place} form.
>
> > 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
> >
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> >
>
>
>
> --
> sam th
> samth at ccs.neu.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121105/bd5240e9/attachment-0001.html>

Posted on the users mailing list.