> From: "Brian Goetz" <[email protected]>
> To: "Remi Forax" <[email protected]>
> Cc: "daniel smith" <[email protected]>, "Dan Heidinga"
> <[email protected]>, "John Rose" <[email protected]>,
> "valhalla-spec-experts" <[email protected]>
> Sent: Mardi 21 Décembre 2021 01:07:15
> Subject: Re: [External] : Re: Do we even need IO/VO interfaces? (was: JEP
> update: Value Objects)
>>> Introducing new interfaces that have no methods is clearly source- and
>>> binary
>>> compatible, so I am not particularly compelled by "some very brittle and
>>> badly
>>> written code might break." So far, no one has proposed any examples that
>>> would
>>> make us reconsider that.
>> ??;
>> you are forgetting inference, this code will fail to compile
>> class A {}
>> class B {}
>> var list = List.of(new A(), new B());
>> List<Object> list2 = list:
> Good catch. There is precedent for leaving certain interfaces out of
> inference,
> though; I suspect we will want to do this for these interfaces too.
The problem is that these interfaces are only useful if they are propagated
along the expression flow.
But
- if something is typed Object or Object[], that information is lost
- if something is typed with an interface, that information is lost (only the
concrete classes implement those interfaces)
- you are saying that in case of inference, they are removed from the flow too.
It seems they are only useful on a blue moon.
Rémi