<div dir="ltr"><div class="gmail_default" style="font-family:monospace">Hello Maurizio,</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for your response!</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Yeah, I see now how my suggestions don't work out. Ultimately, my suggestions force us to think of things with a "beginner" version that doesn't align with the way things would go later. Like you mentioned with a program working with one method, but not 2. Or having one called run and another called main that just so happens to take a String[] parameter.</div><div class="gmail_default" style="font-family:monospace"><br></div><div class="gmail_default" style="font-family:monospace">Thank you for the insight!</div><div class="gmail_default" style="font-family:monospace">David Alayachew<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 2, 2023 at 5:33 AM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.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"><u></u>
<div>
<p>Hi David<br>
</p>
<div>On 01/11/2023 21:23, David Alayachew
wrote:<br>
</div>
<blockquote type="cite">
<div class="gmail_default" style="font-family:monospace">1. In the
name of simplifying things for beginners, what is the reason why
the main method is specifically called "main"? Would not "run"
or something similar be better? The word "main" implies to me
that it is the "main" method (out of all of the others). But
that right there means I must be aware of the concept of there
being multiple methods. But again, that's forcing the beginner
to think about concepts that they don't yet need to. Most
students' first programs will be solely contained in a single
method.<br>
</div>
</blockquote>
<p>I believe calling it any name other than "main" would compromise
one of the main goals of this JEP, which is stated nicely in the
"Growing a program" section (I actually believe this section is,
IMHO, the most important one in the JEP, and the ones that is
driving many of the decisions contained in it!):</p>
<p>
</p><blockquote type="cite">Even so, all members are interpreted just
as they are in an ordinary class. To evolve an implicit class
into an ordinary class, all we need to do is wrap its
declaration, excluding <code>import</code> statements, inside
an explicit <code>class</code> declaration.</blockquote>
<p></p>
<p>Perhaps there's a more intuitive name out there - but regular
classes would still need a "magic" name to pick what they want to
run. And since "main" is the magic name that's been used for the
last 25 years, our hands were a bit forced here...<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<div class="gmail_default" style="font-family:monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace">2.
Alternatively, could we have the name be irrelevant if it is the
only method in the class? If we do that, then the concept of the
"main" method would be really impactful, because, once you
introduce the concept of multiple methods, students are likely
to ask themselves "which method will get run first?" In that
instance, the concept of a method called main wll be extremely
intuitive and understandable. I really like this idea. I feel
like we have an opportunity for a memorable "light bulb" moment
in student's minds. If they ask themselves which method will be
called now that there are multiple, the "main" method will make
perfect sense the first time. It will complicate that launch
protocol. For example, do we allow parameters? I say, it should
follow suit with "main" semantics.<br>
</div>
</blockquote>
<p>Again, quoting from the above section:</p>
<p>
</p><blockquote type="cite">Eliminating the <code>main</code> method
altogether may seem like the natural next step, but it would
work against the goal of gracefully evolving a first Java
program to a larger one and would impose some non-obvious
restrictions (see <a href="https://openjdk.org/jeps/463#Alternatives" target="_blank">below</a>).
Dropping the <code>void</code> modifier would similarly create
a distinct Java dialect.</blockquote>
So, it seems natural for an implicit class with one method to
behave exactly like an implicit class with two methods. Adding
special rules for an implicit class with one method seems ad-hoc
and likely to backfire. E.g. you add a method and your program no
longer compiles or, if you are unlucky and you call the second
method "main" now you launch that one instead, perhaps unkowingly.<p></p>
<p>Cheers<br>
Maurizio<br>
</p>
<p><br>
</p>
</div>
</blockquote></div>