New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes (Preview)
Attila Kelemen
attila.kelemen85 at gmail.com
Mon Apr 10 18:45:40 UTC 2023
Sure, sorry, didn't want to elaborate too long, and lose the main
message (thus only the assertion), but here is my problem in more
detail:
The reason why I don't think it would be useful in general, because it
only makes writing entry points easier, which would give more
incentive to "#!/bin/java" (correct me if I'm wrong, but I vaguely
remember that there is a JEP for java to auto compile java files and
run them), but I find that to be optimistic, since if somebody wants
something like that, the small extra boilerplate won't stop them. So,
basically this JEP provides a minimal simplification of writing an
entry point, and entry points are rare (compared to the rest of the
code). This is merely my opinion, but writing out the small boiler
plate for the entry point didn't bother me at all. Thus, I would say
that this JEP provides little benefit to anyone but beginners. Or
rather, I would throw back the question: What could I gain from using
this? What value do I get from this as a non-beginner? (not trying to
mock you, I'm honestly curious what am I missing here) I did see you
mention on another list that abstract classes could have a main
method, but if we want such a thing, that need not be tied to this
JEP, and we shouldn't prevent future possibilities by introducing this
JEP (such as easier writing of utility classes).
Brian Goetz <brian.goetz at oracle.com> ezt írta (időpont: 2023. ápr.
10., H, 20:17):
>
> > While I like the idea of making the language more beginner friendly, I
> > don't think the proposal in this form is the best way, because it does
> > exactly what it claims to want to avoid: It introduces a separate
> > beginner's dialect. That is, a form of writing code only to be used by
> > beginners and never again.
>
> Since you provide no argument or examples to support your assertion, it is pretty hard to tell where you’ve gone off the trail here.
>
> But your claim that the features here are useful only to beginners and never again is simply incorrect. If you want to unpack your claim, perhaps we can clarify the disconnect.
>
>
More information about the jdk-dev
mailing list