<div dir="auto">Here is a link: <a href="https://github.com/Evemose/jdk/tree/default-parameter-values">https://github.com/Evemose/jdk/tree/default-parameter-values</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 20, 2024, 03:11 ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Oh, thank you. I was wondering why "reply all" didn't work</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 20, 2024, 03:09 David Alayachew <<a href="mailto:davidalayachew@gmail.com" target="_blank" rel="noreferrer">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">You have sent it to only me again. You have not included the mailing list.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">If your email client is automatically only including me, you can manually include all recipients you wanted to include. For example, you can just put <a href="mailto:compiler-dev@openjdk.org" rel="noreferrer noreferrer" target="_blank">compiler-dev@openjdk.org</a> into the TO section of the email.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">And btw, here is how our discussion on this thread looks to the outside community. Click Next message on the top of the page.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://mail.openjdk.org/pipermail/compiler-dev/2024-April/026123.html" rel="noreferrer noreferrer" target="_blank">https://mail.openjdk.org/pipermail/compiler-dev/2024-April/026123.html</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">And here is how our other discussion looks.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://mail.openjdk.org/pipermail/core-libs-dev/2024-April/121787.html" rel="noreferrer noreferrer" target="_blank">https://mail.openjdk.org/pipermail/core-libs-dev/2024-April/121787.html</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Notice how most of your responses are not visible? You can use the archive to make sure that your reply is visible. Here is a list of all mailing lists.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://mail.openjdk.org/mailman/listinfo" rel="noreferrer noreferrer" target="_blank">https://mail.openjdk.org/mailman/listinfo</a></div><div class="gmail_default" style="font-family:monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 19, 2024 at 8:04 PM ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com" rel="noreferrer noreferrer" target="_blank">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><span style="font-size:12.8px">Here is a link: </span><a href="https://github.com/Evemose/jdk/tree/default-parameter-values" style="text-decoration-line:none;color:rgb(66,133,244);font-size:12.8px" rel="noreferrer noreferrer" target="_blank">https://github.com/Evemose/jdk/tree/default-parameter-values</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 20, 2024, 02:59 ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com" rel="noreferrer noreferrer" target="_blank">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Oh, I see. Still learning about how this mailing stuff works. Thank you!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 20, 2024, 02:58 David Alayachew <<a href="mailto:davidalayachew@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">You only responded to me. You must click Respond All, otherwise, only I will see it. Reply to my message again, but do Reply All.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">In fact, through all of the conversations we have been having, you have only been responding directly to me, which means that only I could see it. I did Reply All in my responses so that the rest of the community could see the discussion.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Make sure to do Reply All from now on when sending anything on these mailing lists.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 19, 2024 at 7:32 PM ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Here is a link: <a href="https://github.com/Evemose/jdk/tree/default-parameter-values" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://github.com/Evemose/jdk/tree/default-parameter-values</a><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">сб, 20 апр. 2024 г. в 02:04, David Alayachew <<a href="mailto:davidalayachew@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">davidalayachew@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Unfortunately, I don't have too much more to say, as this is a subject I am not very knowledgeable about. I only know enough to say what I have already, as well as point to videos that discuss this subject.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">As for your working implementation, link it if you are willing. Maybe some more knowledgeable folks would have insight.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 19, 2024 at 6:02 PM ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello! Named arguments are much more complex as they require both declaration-site and invocation-site manipulations. Just default values are much easier, if deal with them in a way kotlin does using compile-time overload generation. The only question I am thinking on right now is should they appear in AST (like default constructor), or added after ( during Enter phase or along with synthetic methods). Second option would be a bit harder to implement, while the first one took me just 100 lines of code (i have a working implementation right now).</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">сб, 20 апр. 2024 г. в 00:44, David Alayachew <<a href="mailto:davidalayachew@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">davidalayachew@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello again,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Default parameter values, while maintaining backwards compatibility with regards to overload selection, is a very difficult task. I don't see a way that it can be done while maintaining backwards compatibility and without turning all methods into virtual dispatch. Brian Goetz spoke of it in this video. He is talking about named arguments at first, but then he addresses default values later.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace"><a href="https://youtu.be/mE4iTvxLTC4?si=lGQ8Y4Oo_YRVXrvr&t=619" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://youtu.be/mE4iTvxLTC4?si=lGQ8Y4Oo_YRVXrvr&t=619</a></div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">But yes, if it can be accomplished, it would be an incredibly valuable feature to have. I would like it.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 19, 2024 at 4:49 PM ІП-24 Олександр Ротань <<a href="mailto:rotan.olexandr@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">rotan.olexandr@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Greetings to the Java developers community.<br><br>I am currently working on default parameter value support for java. Surprisingly, implementation of this feature turned out really simple and non-invasive, no more than a few hundred lines of new code.<br><div><br></div><div>The question I am asking is, should default parameter values be only compile-time constants (or null), or should expressions be also allowed? My opinion is, although this is not a popular choice among existing programming languages, any kind of expression that could be used in variable initializer, should be allowed as default value.</div><div><br></div><div>The reasoning behind this is pretty simple. The main goal of default parameter values, as for me, is to eliminate loads of boilerplate method overloads and problems they bring during development. In almost all popular languages today, for various reasons, if a developer wants to make default parameter value runtime-evaluated, they just have to manually overload method explicitly and pass runtime-evaluated expression as parameter, which essentially is opposite to what default parameter values are needed for</div><div><br></div><div>On the other hand, runtime-evaluated default parameter values seem to be an unpopular option in currently most popular languages, and I am wondering maybe I am missing the point why, because for me, there virtually isn't any reason to forbid them.</div><div><br></div><div>That's why I am reaching out to a Java community to gather opinions on this topic.</div><div><br></div><div>PS: Regarding the way to implement default values, I decided to go with an overload-based approach. This will help to preserve backward compatibility, and also is much easier to implement then call-side parameter injection, which reduces chances of unexpected errors.</div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>