"Model 2" prototype status

Mo Sch moritz.schleunes at gmail.com
Wed Aug 5 11:05:00 UTC 2015


Hi,

i actually like the idea of having value types syntactical separated of ref
types. However when one happens to use any T:

Would something like this possible? (Note the for keyword would be some
syntactic sugar)

class Info<any T> implements for <ref T> InfoDeliveryRef<T>, for <val T>
InfoDeliveryVal<T> {

}

We would need to make sure that InfoDeliveryRef has the same method subset
as InfoDeliveryVal.

Also when the generic knows its type can we instantiate ref T via T t = new
T(); ?


Cheers,

Moritz

2015-08-04 23:38 GMT+02:00 elias vasylenko <eliasvasylenko at gmail.com>:

> "we are more likely to avoid "boxing" ourselves into a corner."
>
> Oh har har har ;).
>
> Thanks for the replies guys, appreciated. If it's a case of not counting
> your eggs until they have been more rigorously specified, and their
> interactions with one another more thoroughly explored, etc., then I can
> totally see where you're coming from. Soft goals need to stay soft until
> the overall picture starts to come together more clearly, sure.
>
> And of course you predicted my naive thought process quite accurately,
> Brian... As you say it does seem intuitive that some manner of boxing would
> happily address whatever arises, nice and simple, but yeah, I can
> appreciate this is just scratching the surface! It is nice to hear you
> expand a little on your general approach to and thoughts on this though,
> even without diving into the real depths of it, and even if you have had
> other more pressing concerns up 'til now.
>
> At any rate, I certainly have no problem just waiting and seeing what
> happens. My blind optimism will tide me over happily until these further
> updates you speak of.
>
> Thanks again for putting all this out there,
>
> Eli
>
> On Tue, 4 Aug 2015 at 21:33 Martijn Verburg <martijnverburg at gmail.com>
> wrote:
>
> > Hi Eli,
> >
> > It's simply too early to tell and will need some more investigation by
> the
> > core valhalla team, we're going to have to be patient and wait until
> > they've explored this particular interaction further :-).
> >
> > Cheers,
> > Martijn
> >
> > On 4 August 2015 at 21:24, elias vasylenko <eliasvasylenko at gmail.com>
> > wrote:
> >
> >> This all sounds pretty encouraging so far to me. I feel like all my
> major
> >> tick boxes are being steadily, if tentatively, filled. Thanks for the
> >> update!
> >>
> >> I do have one new concern though - something you said earlier jumped out
> >> at
> >> me, Brian:
> >>
> >> "So its quite possible that Foo<any T extends Comparable> may in fact be
> >> meaningful.  (And if that's the case, primitives might join the party
> >> too.)  Or not, we're not sure yet."
> >>
> >> I suppose this must mean there is a realistic possibility that will
> *not*
> >
> >
> >> in fact be meaningful, which is a surprise to me... Is this something
> that
> >> has been discussed in more depth and I missed it? If anyone could expand
> >> on
> >> this a little (preferably to give a little reassurance that I'm
> >> overreacting to the importance, or that the chances are low for this to
> >> end
> >> up being the case!) I'd be pretty relieved. It feels like it'd be a
> pretty
> >> huge blow, and given my (limited) understanding I can't see what
> >> particularly troublesome issues this even presents.
> >>
> >> Cheers,
> >>
> >> Eli
> >>
> >> On Sat, 1 Aug 2015 at 22:49 Brian Goetz <brian.goetz at oracle.com> wrote:
> >>
> >> > > I dislike the Foo<ref> / Foo<any> thing for several reasons.
> >> >
> >> > Not surprising.  This wasn't our first choice either.
> >> >
> >> > We spent a great deal of effort investigating whether it was possible
> to
> >> > re-use Foo<?> to mean Foo<ref> when the corresponding tvar is a ref
> >> > tvar, and to mean Foo<any> when the corresponding tvar is an any tvar.
> >> > Seems obvious, right?
> >> >
> >> > Several hundred hours later, the short answer is that things fall
> apart
> >> > when a library is any-fied and the client is not recompiled; this
> would
> >> > make any-fication a binary-incompatible change, which would be a
> loser.
> >> >   So with tears in our eyes, we reluctantly concluded that we needed
> to
> >> > differentiate between Foo<ref> and Foo<any>.  Once we swallowed that
> >> > pill, many things snapped into place.  So as sad as it is to have two
> >> > kinds of wildcard, I'm pretty sure its the right call.
> >> >
> >> > You prefer another syntax?  Sure, I'm sure there are alternatives.  We
> >> > can talk about it -- but not this year!  We have way more important
> >> > things to work out before that comes anywhere near the top of the
> list.
> >> >
> >> > As to bounds...  we're still working out the details of the
> interaction
> >> > between value types and interfaces.  So its quite possible that
> Foo<any
> >> > T extends Comparable> may in fact be meaningful.  (And if that's the
> >> > case, primitives might join the party too.)  Or not, we're not sure
> yet.
> >> >
> >> >
> >> >
> >>
> >
>



More information about the valhalla-dev mailing list