Fwd: Remi's comments on Any

Gavin King gavin at hibernate.org
Mon Jan 5 19:46:39 UTC 2015


On Mon, Jan 5, 2015 at 5:04 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> As a simple example, suppose than in Java 5, we pushed autoboxing deeper,
> and let you write:
>
>   List<int>
>
> and really that was just sugar for List<Integer>.  This gives the illusion
> of a prettier type system,

Well I guess I don't favor saying that List<int> means List<Integer>,
since a List<Integer> can contain null elements. Yes I know that
Java's type system doesn't provide typesafety around null, but I still
think it would be unfortunate if "int" sometimes meant "can be null".

OTOH, it might be reasonable to make List<int> be a subtype of List<?
extends Integer>, interpreting Integer to mean, essentially, int|null.

> I get that you've convinced yourself that its possible to just magically
> remove the complexity (just introduce Any!) and then you get the best of
> both worlds.

No, I certainly have not convinced myself of that, as you can see from
what I've written in my emails above. It's one potential path, and if
it doesn't work, then I'd like to understand why it doesn't work.

> But given that the JVM implementation experts have not
> responded with "gee, brilliant idea, thanks!", perhaps you should consider
> that this approach is not as straightforward as you think?

One of the interesting things about our field is that we don't have to
just take the assertions of experts, and believe them to be true,
without looking for the reasoning behind the assertions. Knowledge in
computing isn't of some esoteric nature, inaccessible to mere ordinary
men.

This is just like in other STEM fields: if an expert mathematician
asserts a conjecture, without providing a proof of that conjecture, we
don't call it a theorem. Likewise, if a great scientist claims to have
experimental results that support a theory, we aren't obliged to
accept that theory unless the scientist provides the information we
need to reproduce an experiment and replicate its results.

So when an expert makes an assertion, and isn't prepared to explain
the reasoning behind it, it appears as if the expert isn't very
confident in the soundness of their reasoning, and that immediately
leads one suspect that the reasoning might in fact not be sound. It's
not a waste of time, in such cases, to attempt to understand and
reproduce the reasoning, because even experts make mistakes from time
to time.

Therefore "just trust us, we know what we're doing" is pretty much an
invitation to *distrust* the assertion.

-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org


More information about the valhalla-dev mailing list