Hello, I have a similar need (in terms of processing the expanded program 
from typed racket) and came across this post. Unfortunately I am a racket 
newbie and I don't quite understand the code in typed-racket/core.rkt. Can 
you please give me some pointers as to what code I should copy/paste? I am 
hoping that I can do something like:

(define-syntax-rule (my-module-begin prog ...)
  (#%module-begin 
    (let [(expanded (call-typed-racket-to-typecheck prog ...)] 
(my-processor expanded) ))

(define (my-processor prog ...)
  (if (query-return-type-from-typed-racket prog integer?) (println "int") 
;similarly for other cases
))

Any suggestions on how I can implement call-typed-racket-to-typecheck and 
query-return-type-from-typed-racket?

-D

On Thursday, August 9, 2018 at 7:43:38 PM UTC-7, Ben Greenman wrote:
>
> Typed Racket first runs the macro expander, and then type checks the 
> expanded program. 
>
> If your implementation can type check an expanded program too, then 
> you can probably get started by copy/pasting typed racket's 
> #%module-begin and inserting a new pass over the program just after 
> the optimizer. Here's one place to get started looking for what to 
> re-use:* 
>
> https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/core.rkt#L34
>  
>
> If your implementation wants to type check the surface syntax of a 
> program, then maybe you can hack something together using the above 
> strategy and the source-syntax library: 
> http://docs.racket-lang.org/source-syntax/index.html 
>
>
> * I think it'd be nice if typed racket provided an "expand + 
> type-check" function that other #langs could re-use, but AFAIK it 
> doesn't yet 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to