<p><br>
On Jul 5, 2012 8:50 PM, "Neil Toronto" <<a href="mailto:neil.toronto@gmail.com">neil.toronto@gmail.com</a>> wrote:<br>
><br>
> I just found this today:<br>
><br>
><br>
> #lang typed/racket<br>
><br>
> (define: b : (Boxof Any) (box 4))<br>
><br>
> (define-predicate boxof-integer? (Boxof Integer))</p>
<p>This is the bug -- there's no way to write the boxof-integer? predicate, and define- predicate shouldn't think it can.</p>
<p>> (define (set-b-box! v) (set-box! b v))<br>
><br>
> (: a-very-listy-integer (-> Integer))<br>
> (define (a-very-listy-integer)<br>
> (cond [(boxof-integer? b) (set-b-box! '(1 2 3))<br>
> (unbox b)]<br>
> [else (error 'a-very-listy-integer "can't happen")]))<br>
><br>
><br>
> > (a-very-listy-integer)<br>
> - : Integer<br>
> '(1 2 3)<br>
><br>
><br>
> Is this a bug or a limitation? It can be replicated with any mutable container type as far as I can tell.</p>
<p>A bug. Anytime you get a result like that it's a bug.</p>
<p>><br>
> Also, if it's a limitation, can I get (Vectorof Index) to be a subtype of (Vectorof Integer)?</p>
<p>No, that relationship would be unsound for similar reasons.</p>
<p>> Neil ⊥<br>
> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev">http://lists.racket-lang.org/dev</a><br>
</p>