On 2016-01-28 21:48:12 -0500, Scott Moore wrote:
>    For example, in the following scenario it isn’t possible (as far as I
>    could see) to write a
>    contract that allows a subclass to be used in place of a superclass, but
>    only with the
>    superclass’s interface. Did I miss a way to write this?

For your specific example, Typed Racket does not actually compile `Object`
types to `instanceof/c` contracts. Instead, it compiles to a custom TR-defined
object contract that will enforce a more "lazy" form of opaqueness.

i.e., it only errors when you try to call a method you shouldn't be able to
access like `bar`.

You can't actually use the contract TR uses in ordinary Racket programs though
(because they are part of TR's private modules).

Opaque class contracts are only used when a class value itself flows from
untyped to typed.

Cheers,
Asumu

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/20160129025549.GG15583%40simplyrobot.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to