On syntax expansion. Is there a way to determine in the macro whether I'm expanding in a typed/racket environment vs regular racket.? Say for example in place.rkt conditionally embellish the syntax templates with additional TR annotations if the syntax is being expanded in TR vs R.<div>
<br></div><div>Thanks,</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 5, 2012 at 3:14 PM, Ray Racine <span dir="ltr"><<a href="mailto:ray.racine@gmail.com" target="_blank">ray.racine@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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. <div>
<br></div><div>Time to saddle up and start charging them windmills.<br><div><br></div><div>Thanks,</div><div><div class="h5"><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 5, 2012 at 2:50 PM, Sam Tobin-Hochstadt <span dir="ltr"><<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On Mon, Nov 5, 2012 at 1:58 PM, Ray Racine <<a href="mailto:ray.racine@gmail.com" target="_blank">ray.racine@gmail.com</a>> wrote:<br>
> Consider the innocuous appearing snippit below from<br>
> collects/racket/place/distributed/examples/hello-world.rkt<br>
><br>
> #lang typed/racket<br>
><br>
> (require racket/place/distributed<br>
> racket/place)<br>
><br>
> (provide hello-world)<br>
><br>
> (: hello-world (-> Place))<br>
> (define (hello-world)<br>
> (place ch<br>
> (printf "hello-world received: ~a\n"<br>
> (place-channel-get (assert ch place-channel?)))<br>
> (define HW "Hello World")<br>
> (place-channel-put (assert ch place-channel?) (format "~a\n" HW))<br>
> (printf "hello-world sent: ~a\n" HW)))<br>
><br>
><br>
> First issue is:<br>
> `place' is syntax entailing 2 closed over procs `place/proc' and<br>
> `start-place defined in racket/place. No prob. I know the secret<br>
> incantation.<br>
><br>
> So I add a couple of strawman typings base-special-env.rkt and these<br>
> immediate undefined identifier errors magically go away.<br>
><br>
> ;; from the expansion of `place'<br>
> [(make-template-identifier 'place/proc 'racket/place)<br>
> (-> -Variable-Reference -Symbol -Symbol (-> -Symbol -Resolved-Module-Path<br>
> -Symbol (-opt -Input-Port) (-opt -Output-Port) (-opt -Output-Port) -Place)<br>
> (-opt -Input-Port) (-opt -Output-Port) (-opt -Output-Port)<br>
> -Place)]<br>
> [(make-template-identifier 'start-place 'racket/place)<br>
> (-> -Symbol -Resolved-Module-Path -Symbol (-opt -Input-Port) (-opt<br>
> -Output-Port) (-opt -Output-Port)<br>
> -Place)]<br>
><br>
> The next one in the conga line is an unknown identifier error for `place?',<br>
> which _is_ publicly exported by racket/place. But `place?' is itself<br>
> syntax, so I donno, we have some sort of require-syntax-for-syntax sort of<br>
> thing going on.<br>
><br>
> Just for laughs I tossed the below into base-special-env.rkt. and now<br>
> hello-world.rkt has errors on duplicate definition of `place?'.<br>
> [(make-template-identifier 'place? 'racket/place)<br>
> (-> Univ -Boolean)]<br>
<br>
</div></div>If `place?` is indeed exported by `racket/place`, then the above won't<br>
work. You'll need to give a type to the internal identifier that<br>
`place?` expands into.<br>
<br>
However, looking at the expansion of the hello-world.rkt program, it<br>
doesn't seem to contain `place?`. So I'm confused as to where that's<br>
coming from.<br>
<br>
Finally, the way the `place` form works means that it would be better<br>
to give a type annotation to `ch` using the #{ch : Place} form.<br>
<div><br>
> Any ideas on how move forward? The idea was to take a run at TRing the<br>
> collects/racket/place/distributed/examples/hello-world.rkt<br>
><br>
> Thanks in advance,<br>
><br>
> Ray<br>
><br>
><br>
</div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
<br>
<br>
<br>
--<br>
sam th<br>
<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a><br>
</blockquote></div><br></div></div></div></div></div></div>
</blockquote></div><br></div>