Re: Figuring out easier readonly interfaces

On Wed, Oct 2, 2013 at 6:08 PM, Mark S. Miller <erights@google.com> wrote:
> If Foo is a subtype of Bar and you pass a Bar to a function that takes a
> Foo, what should happen?

This is passing a supertype instance to a method that expects a
subtype instance.  Ideally, it should work as long as you only use
parts that exist in the supertype.

> I ask because Foo is a almost an LSP subtype of readonly<Foo>. The LSP
> common supertype of Foo and readonly<Foo> has exactly the signature of
> readonly<Foo>.

Yes.

~TJ

Received on Thursday, 3 October 2013 01:11:52 UTC