[racket-dev] "Disjoint" unions (from PR 13131)

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Sep 22 12:38:45 EDT 2012

On Sat, Sep 22, 2012 at 12:20 PM, Eli Barzilay <eli at barzilay.org> wrote:
>> What I'm suggesting is that some unions (e.g. `Natural') be opaque
>> even to the introspection tool. Since there's no way to get
>> something to typecheck as `Positive-Integer-Not-Fixnum' (the
>> typechecker will never give that type to anything, it's just a trick
>> to get more precise intersections) showing it in `:type''s output is
>> confusing.
> That's mainly something that goes in the PR, since with my thing there
> is some point in showing the hidden types.  But the similarity is how
> the above translates to my case: I want a way to treat my user-defined
> `SOMETHING' as opaque, and I want to hook into the typechecker a
> restriction that TR would never give the hidden `This' type to
> anything.  (And I think that I have that latter part, for >=2
> variants.)

But you need the type `This` to be used in typechecking the expansion
of `cases`, so that `This-field` selection works.
sam th
samth at ccs.neu.edu

Posted on the dev mailing list.