[racket] Typed Racket: Infinite Subtypes?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Jun 10 19:15:46 EDT 2011

On Fri, Jun 10, 2011 at 7:03 PM, Richard Lawrence
<richard.lawrence at berkeley.edu> wrote:
> Sam Tobin-Hochstadt <samth at ccs.neu.edu>
> writes:
>
>> I'll try to respond more comprehensively about the more general
>> question, but for this:
>>> (define-type Variable (Pair 'var Symbol))
>>> (define-predicate variable? Variable)
>>
>> Just use a struct:
>>
>> (struct: variable ([s : Symbol]))
>>
>> Now you have `variable' and `variable?' and `variable-s', and there's
>> no confusion with pairs.  That's how I'd write this code.
>
> Ah, duh.  Thanks, Sam.  (I take it this means that the answer to my more
> general question is, ``No, you can't do that,'' but I'll be interested
> to read your response when you've got time to send it.)

As it turns out, the answer to the more general question is: we have
an experimental mechanism to do that, called refinement types, that
seems to be currently broken.  Once I fix it, I'll respond again.

-- 
sam th
samth at ccs.neu.edu



Posted on the users mailing list.