Alas, ensnared again by TR the seductress. Why must you raise my hopes only to 
dash them again?

To be more specific: I want to use TR to specify types for some of the 
stepper’s structures. However, structures containing syntax objects are giving 
me fits. Here’s a simple program:

#lang racket

(module sub typed/racket
  (provide (struct-out wrapper))

  (struct wrapper ([x : Any])))

(require 'sub)

(wrapper-x (wrapper #'1234))

This type-checks, but fails at runtime with the error:

wrapper-x: contract violation
  Attempted to use a higher-order value passed as `Any` in untyped code: 
#<syntax:/private/tmp/bar.rkt:10:22 1234>
  in: the range of
      (-> wrapper? Any)
  contract from: (/private/tmp/bar.rkt sub)
  blaming: /private/tmp/bar.rkt
   (assuming the contract is correct)
  at: /private/tmp/bar.rkt:6.10
>

I’ve tried a bunch of things, including specifying a good type for the x field 
((Syntaxof Number) works, but in general I want to be able to specify any 
syntax object), and putting the lookup on the TR side (still get the same 
error). I really can’t think of a way of working around this problem.

Oh! I just thought of something really evil… create a bogus submodule with an 
OpaqueVal type that wraps anything… nope, sigh, that didn’t work either.

Any help appreciated!

Thanks,

John


-- 
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.

Attachment: signature.asc
Description: PGP signature

Reply via email to