r/java • • 19d ago

Withdrawing the Primitive Patterns preview feature in JDK 28

https://mail.openjdk.org/archives/list/amber-spec-experts@openjdk.org/thread/UYEK3PGOHN6R56AHJTSLPGAY363K666S/

Primitive Types in Patterns will be removed in JDK 28 and will no longer be available in that release.

The Valhalla project has been exploring a new vision for Java numerics, including the possibility of user-defined numeric types. New kinds of numeric types would need to support exact numeric conversion, and vice versa. Given that the Valhalla work is still evolving, it would be premature to finalize Primitive Types in Patterns with their current definition of exact numeric conversion.

94 Upvotes

36 comments sorted by

View all comments

Show parent comment

2

u/TheStrangeDarkOne 19d ago

Is there a document or a string of e-mails regarding witnesses? I remember Brian talking about the concept well over year ago but I couldn't find how it has developed since then.

6

u/brian_goetz 14d ago edited 14d ago

There is not. There is a vague "exploration of a possible direction" (my video from JVMLS). But that hasn't stopped folks (looking at you, u/pjmlp) from assuming that whatever illustrative examples shown (despite contemporaneous disclaimers) were not only the actual design, but the *actual syntax* (and then jumping into bikeshed mode!)

Bear in mind that JVMLS is an extremely unusual conference; the audience of ~100 or so are almost exclusively VM and language designers and implementors. The talks are aimed to that audience, and only incidentally put up on YouTube for broader consumption. So it is virtually guaranteed that some folks will misunderstand what they are seeing, and then spread misinformation. (That sucks, but the next alternative is just not putting the talks up at all, and the alternatives get worse from there.)

3

u/TheStrangeDarkOne 14d ago

Thank you for the personal reply Brian! I've actually been an avid reader of the mail archivies and I'd like to take this opportunity to say that I always found your nuanced takes quite inspiring.

Among others, I remember when you brought up the topic of "tearable value types" and the "violation of cross-field constraints" with the subsequent creation of the 4 value-buckets. There was much resistance at what seemed like a minor annoyance at first but it lead to a stronger design overall.

Personally, I'm really excited about the way value types have shaped out in the same way "Functional Interfaces" are a more interesting takes on "function pointers".

Thank you for your dedicated stewardship of the language!
I'd like to hope that some of it will be reused in languages of the future to come.

0

u/pjmlp 13d ago

Thanks for the reply, what has put me off, was the whole initial approach, and the name "witness types" for what everyone else calls traits or type classes.

It was rather confusing to get where this naming came from, and as someone that enjoys reading SIGPLAN papers I am not sure where in type theory they come from either.

It was a bit like when Stable Values where proposed, even though everyone else calls them lazy values, which lazy constants sound much more closer to.

1

u/0x07CF 19d ago

I think there was a also a video of a talk

1

u/TheStrangeDarkOne 19d ago

Any chance you remember the title or have a link? 🤔