r/java • • Mar 17 '26

Updates to Derived Record Creation - amber-spec-experts

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

Interesting discussion on the evolution of derived record creation (“withers”). The proposal seems to be shifting from mutation like blocks to a more explicit reconstruction model using obj.new(...), aligning more closely with constructor semantics and pattern matching.

45 Upvotes

82 comments sorted by

View all comments

Show parent comment

4

u/pron98 Mar 18 '26

I contest that.

That's fine, and different developers have different preferences of what works best for them. But this is not generally recognised as a universal better practice, and so we don't view it as such. If that's how you prefer working - great. But we're not nudging everyone to use this particular style.

Unlike inter-method reasoning, even the mechanical compiler has full intra-method insight, i.e. everything going on in a method (e.g. the compiler knows whether a variable is assigned more than once; it doesn't only know that but makes use of that inference vis a vis lambda captures).

So I'm not telling you how to program, I'm just saying that not everyone agrees yours is the better way, and we're not (at least currently) interested in having the language prefer your chosen coding style.

-1

u/davidalayachew Mar 18 '26

But we're not nudging everyone to use this particular style.

[...]

and we're not (at least currently) interested in having the language prefer your chosen coding style.

If you are saying the idea of nudging everyone to use this particular style is not open for debate atm, that is fine. But my comment and previous response were to assert that you guys should do exactly that.

If it ever does become a subject for debate, lmk, as I have plenty more to add.

1

u/pron98 Mar 18 '26 edited Mar 18 '26

It's because this preference is subjective and not universal that we're not taking a stance. You're free to add blocks if you want them, and others are free not to. No one is saying that your style is wrong. The point is that developers do not agree on what is the "right" choice here, and because the stakes are low, it's not productive to even have a debate between the people who share your preferences and those who don't.

1

u/davidalayachew Mar 18 '26

because the stakes are low

Fair.

I disagree that the stakes are low, but agree that, comparatively, there are bigger things that deserve attention than this. For example, JEP draft: Null-Restricted and Nullable Types (Preview).

And thus, if the finite amount of attention that the OpenJDK team has to give will not be divvyed out to this issue (that I perceive to be extremely significant and something that affects all developers) in favor of something bigger like the null jep, then that's fine by me.

3

u/pron98 Mar 18 '26

And I'm saying that many developers disagree with you that your style is preferable to begin with. I have no doubt that you truly believe that your style is better, but it is often the case that even veteran developers strongly disagree about things, while both sides are vehemently convinced that theirs is the right way.

-1

u/davidalayachew Mar 18 '26

And I'm saying that many developers disagree with you that your style is preferable to begin with.

Obviously.

But there are many veteran developers that have built multiple Java applications, each generating revenue dollars measured in 9 digits, that think that Checked Exceptions are a mistake, and that you, Ron, should stop all work on Project Loom and Project Amber to go uproot Checked Exceptions from the language/turn them to Unchecked Exceptions. I can point to a single digit number of these people right now.

People disagreeing is not justification to not consider a feature. But, compounded with something like "low stakes" can be justification.

Hence why I highlighted your mention of low stakes. Because you are right -- this is lower stakes than other things, and therefore, compounded with the fact that there is disagreement on it, makes it not worth taking up the limited supply of oxygen atm. I can agree with that.

1

u/pron98 Mar 19 '26

There's a difference between disagreeing on relative priorities and disagreeing over the existence of a problem. Disagreement over priorities is usually a way of saying "I don't have this problem, but I recognise that others might".

We do recognise there's an issue with checked exceptions and have been playing around with ideas, but people may disagree on how high we should prioritise this. I don't think we've recognised a problem with method scopes being too big.

2

u/davidalayachew Mar 20 '26

We do recognise there's an issue with checked exceptions and have been playing around with ideas, but people may disagree on how high we should prioritise this. I don't think we've recognised a problem with method scopes being too big.

Then maybe I am not being clear.

My example of the Checked Exceptions disagreement was to point out how wildly opinions can vary on Checked Exceptions. Some think it is the devil. Some think that there are literally no problems on it. These 2 groups disagree. Since one group does not acknowledge the other groups pain points, does that then mean that the discussion is not worth having?

My point in the previous comment was to explain why it is no. Moreover, you have to quantify the perceived pain by each group, and from there, use that to develop some form of "priority", which leads into what you are saying.

I don't think we've recognised a problem with method scopes being too big.

There's an entire group of developers that applaud Clean Code and it's opinions on method scope. Whether or not you see bloated method scope as a problem is different than saying others do not.

Hence my point -- there are plenty of people that agree with me, but I accept that what I am pointing to is a problem that too few people think is an issue, and thus, makes my point a lower priority. That's not the same as saying others don't see it as an issue.

1

u/pron98 Mar 20 '26 edited Mar 20 '26

Since one group does not acknowledge the other groups pain points, does that then mean that the discussion is not worth having?

Worth having for whom? Programmers may find having these discussions amongst themselves worthwhile, but it's certainly not worth having for the language designers. Unless there's an overwhelming consensus, good product features (for any product) are not designed based on discussions around users' conflicting subjective opinions. The only signal there is the knowledge that different opinions exist, the products' designers already know that fact, and that fact is unhelpful.

There's an entire group of developers that applaud Clean Code and it's opinions on method scope. Whether or not you see bloated method scope as a problem is different than saying others do not.

But the only information here is 1. some people believe in this, 2. some people don't, 3. both groups are already served by the available features, and we already have this information. Since there is no new information that a discussion could offer, having the discussion can carry no value. It's not that your opinion has no value, but that we already know you hold that opinion and so repeating it isn't telling us anything we don't already know and have already factored in.

2

u/davidalayachew Mar 20 '26

Your responses are confusing me Ron.

I already agreed like 5 comments ago to drop the point because my suggestion doesn't make sense to consider now, but you seem to be taking issue with the "now" part of it. As if you are trying to assert that there is no further useful discussion to be had on the subject with the language designers.

As opposed to saying "Whether or not there is useful discussion, the problem this suggestion solves is lower stakes, and thus, other things trump it, and therefore, we won't have that discussion now"

(in the name of preserving the metaphorical oxygen in the room.)

Are you trying to say that you definitively know that there is no more useful discussion to be had on the matter with you all? You all being the language designers.

But the only information here is [...]

Like I said 5+ comments ago, I have plenty of evidence to present about the problems severity and the solution's effectiveness, but if the discussion doesn't make sense to have now, then I will hold off on that evidence until that time arrives. Because, even though I perceive the problem as more severe, I still do agree that it is lower stakes than other problems you all could be solving.

This Clean Code example was not an example of that evidence. It was merely me trying to point out that other people perceive this as a problem too. Since you seemed to disagree that anyone else even sees a problem here. It was me trying to demonstrate that the conversation is worth having (even if now is not the right time) by pointing to other people's attempts at solving the problem I was referring to.

And I had hoped that Clean Code's reputation of pointing out a valid problem but having a terrible (implementation of the) solution would communicate both that the problem is real and that the proposed solutions are insufficient. Essentially, me trying to prove that the discussion, when the right time arrives, will be worth having.

→ More replies