Fwd: Proposal for generics over primitives needs a rethink

Gavin King gavin at hibernate.org
Fri Jan 2 16:44:54 UTC 2015

On Fri, Jan 2, 2015 at 5:08 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> On the other hand, an Any relative to to today's JVM would be a harmful
> fiction, because it *seems* so natural, and yet, our tools for representing
> it in bytecode would have serious impedence mismatches with user
> expectations.  This is bait-and-switch for users, and a lifetime of pain for
> implementors.  (I had more to say about this topic at my JVMLS keynote from
> this year; video is online.)

OK, so then please:

1. first, explain what you think the user expectations for Any are, and then
2. give us some code examples where those user expectations would be
    violated according to the semantics I've suggested for Any.

>> It's quite possible, of course, that you've already invested a lot of
>> time into making Any work, and found that it doesn't work because of
>> certain obscure, highly technical points that I have not yet stumbled
>> upon.
> Yeah, I think is pretty close to right (except for the assumption that the
> only reason we'd reject it is some obscure technical point you've not yet
> thought of -- we reject all sorts of things that are technical feasible, for
> reasons of compatibility, consistency, maintainability, philosophy, resource
> availability, priority, security, or just plain "not good enough", and even
> if the reasons were perfectly transparent, you still might not agree with
> them.)
> But, yes, we've explored it in substantial depth, and we still don't see a
> feasible and acceptable path.  (And we probably will continue to think about
> it; sometimes your first ten ideas are wrong but that doesn't stop you from
> continuing to try.)

OK, so that's all well and good, but you've essentially dodged the question
here: *what*, precisely, is it that makes Any not:

- compatible,
- consistent,
- secure, or
- otherwise not "good enough".

Because I've asserted that there are at least two ways to implement
Any that are, as far as I can tell, compatible, consistent, secure,
and "good enough", and you've not responded with any concrete
explanation for why they're not.

All I'm asking for is a concrete explanation of what is wrong with my
suggestion instead of handwaving and complaints about my "attitude".
Surely that's not too much too ask? I mean, you've asked me to be
"constructive", and I'm making a concrete, constructive, technical
suggestion. You say you've explored the idea in "substantial depth"
and discovered it to be "unfeasible". So surely, after that in-depth
exploration, you must have arrived at some pretty good concrete
conclusions that you could have documented in the proposal for
"specializations", and that you could have included in your responses
to my email.

>> But if that's the case, then neither the design document for
>> specialization, nor your above email, hints at what these issues might
>> be. At the very least they should be highlighted in the paper so that
>> the Java community understands what they are.
> Sure, in a perfect world, our brains would be available on the internet for
> direct neural queries, and all curiosities could be satisfied (or maybe
> not.)  In the world we've got, we try our best to balance moving things
> forward with providing after-the-fact explanations of our thought processes
> and what we've explored.  But this is not always possible in the detail,
> time-frame, or angle of view that everyone with a question would like.  That
> may suck, but we need to focus our energy primarily on the search for the
> right answers.

I don't understand. Do you or do you not have a concrete explanation
for what is wrong with Any?

- If you do, then please share it with us, because it's missing from
the paper which I and others have taken the time to read and
understand and evaluate.
- Otherwise, if you don't have any such explanation, then there's
something missing here, and it seems to be that Any should be back on
the table for consideration.
- Or are you saying that such an explanation exists, but you're for
some reason unable to share it with me?

I've always considered that we, as language designers, have a
professional and ethical responsibility to be able to justify the
decisions we make. I personally make a point of always having some
sort of technical justification for every decision I make, and take
time to communicate the reasoning to folks from our user community who

Gavin King
gavin.king at gmail.com

More information about the valhalla-dev mailing list