New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes (Preview)
Hunor Szegi
hunor.szegi at gmail.com
Tue Apr 11 20:29:33 UTC 2023
Hi All,
Thank you for this new proposal, I like the idea of JEP 445 with the
flexible main methods. My only concern is the implicit "static" keyword.
Which means the initially learned main method format should be modified
later, so this doesn't really support the gradual learning curve. It is
even a little bit against the goal "Do not introduce a separate beginner's
dialect of Java."
I would consider a bigger step, supporting a main() method without the void
return type and modifiers (Similarly to the constructor declaration, where
the missing return type makes it a different kind of thing. And the name is
also fixed there. But in this case we don't need the public and static
modifier.) It would not be specific for the anonymous classes. (So it isn't
a separate beginner's dialect.)
I know it would create a new language element. But all the problems with
another method named "main" will be gone. (No need for the "selecting the
main method" logic.)
Thanks,
Hunor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230411/75c9cf59/attachment.htm>
More information about the amber-dev
mailing list