<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><span style="font-family: Charter, serif; font-size: 18px; line-height: 24px; background-color: rgb(255, 255, 255);">Furthermore, even if the wrappers </span><span style="margin: 0px; padding: 0px; font-family: Charter, serif; font-size: 18px; line-height: 24px; background-color: rgb(255, 255, 255); font-style: italic;">were</span><span style="font-family: Charter, serif; font-size: 18px; line-height: 24px; background-color: rgb(255, 255, 255);"> shared between functions, untyped code would recieved wrapped values, which would render them quite useless.</span></div><div><br></div><div>If it’s not an opaque type, but something like a list, then this works, and the untyped code receiving wrapped values isn’t a problem here:</div><div><div>#lang typed/racket</div><div>; make Posn parametric</div><div>(define-type (Posn A) (List A A))</div><div>(provide Posn)</div><div>(require/typed/provide</div><div> "untyped.rkt"</div><div> [make-posn (All (A) A A -> (Posn A))]</div><div> [posn-x (All (A) (Posn A) -> A)]</div><div> [posn-y (All (A) (Posn A) -> A)]</div><div> [real-posn? [(Posn Any) -> Boolean]])</div></div><div><div>> (define p (make-posn 1 2))</div><div>(make-posn #<A6> #<A6>) ; a printf that I put in make-posn from “untyped.rkt"</div><div>> p</div><div>- : (Listof Positive-Byte) [more precisely: (List Positive-Byte Positive-Byte)]</div><div>'(1 2) ; unwrapped</div><div>> (posn-x p)</div><div>- : Integer [more precisely: Positive-Byte]</div><div>1</div><div>> (posn-y p)</div><div>- : Integer [more precisely: Positive-Byte]</div><div>2</div><div>> (real-posn? p)</div><div>- : Boolean</div><div>#t</div></div><div><br></div><div>Even though for a short time it's wrapped, it’s unwrapped as soon as make-posn returns, and then after that if it flows into untyped code again it’s not wrapped and functions like real-posn? work fine.  </div><div><br></div><div>But the problem is that if it’s an opaque type then it can’t unwrap it once the value is returned from make-posn.</div><div><br></div><div>And I don’t think parametric opaque types could solve this unless all posns themselves were wrapped with an opaque struct on the typed side, which I guess does make sense now that I think about it.  But then you couldn’t do any operations on it except those that you use import with require/typed, right?  Or not?  And what happens if you use cast on one of these things?</div><div><br></div><br><div><div>On Jan 29, 2015, at 9:25 PM, Alexis King <<a href="mailto:lexi.lambda@gmail.com">lexi.lambda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I recently ran into a problem in which opaque types (types imported from untyped code) cannot by parameterized by Typed Racket. I initially encountered this problem in <a href="https://github.com/lexi-lambda/racket-2htdp-typed/issues/1" class="">my attempt to port 2htdp/image to TR</a>.<div class=""><br class=""></div><div class="">After some further consideration, I’m interested in adding support to make something like this possible, which would certainly have additional benefits beyond this specific use-case. I’ve outlined my proposal here:</div><div class=""><a href="http://lexi-lambda.github.io/racket-parametric-opaque-types/" class="">http://lexi-lambda.github.io/racket-parametric-opaque-types/</a></div><div class=""><br class=""></div><div class="">Any feedback, suggestions, or advice would be appreciated, especially from those who are familiar with Typed Racket’s internals.</div><div class=""><br class=""></div><div class="">Thank you,</div><div class="">Alexis</div></div>_________________________<br>  Racket Developers list:<br>  <a href="http://lists.racket-lang.org/dev">http://lists.racket-lang.org/dev</a><br></blockquote></div><br></body></html>