New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes (Preview)
Ken Fogel
omniprof at gmail.com
Tue Apr 11 00:00:31 UTC 2023
As someone who has lamented the decorations necessary to say Hello World, I am excited about this JEP. Python is eating our lunch because it supports the stream of consciousness Design pattern, make it work and then maybe make it nice.
That is not to say this simplification for new users won’t lead to the same poor design pattern, a good instructor or good book can point out that this new style is about understanding syntax and then methods. From here you can move to OOP or Functional in Java.
I applaud this new JEP.
Ken Fogel
________________________________
From: jdk-dev <jdk-dev-retn at openjdk.org> on behalf of Brian Goetz <brian.goetz at oracle.com>
Sent: Tuesday, April 11, 2023 7:24:24 AM
To: Attila Kelemen <attila.kelemen85 at gmail.com>
Cc: amber-dev at openjdk.org <amber-dev at openjdk.org>; Ron Pressler <ron.pressler at oracle.com>; jdk-dev at openjdk.org <jdk-dev at openjdk.org>
Subject: Re: New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes (Preview)
As you allude to, there is already the “Single File Source Launcher”, which let’s you run a Java program directly from the command line without compilation (`java Foo.java`), which has been around for a while, and additionally does support “shebang” execution. (There are plans to extend this further.). This was aimed at script-like programs, which, while not written by beginners, also do not require the ceremony of the class declaration. So the design center here is not “beginning programmers”, but “simple programs”, but of course there is a lot of intersection between the two — beginning programmers write simple programs.
There is also a chicken-and-egg problem here; one of the reasons people don’t write script-like programs in Java so often is because of the declaration and building overhead. But that’s an accidental consequence, and we can remove these impediments. So students may be the most obvious group of beneficiaries, but they are not the only ones.
> On Apr 10, 2023, at 11:45 AM, Attila Kelemen <attila.kelemen85 at gmail.com> wrote:
>
> 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.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230411/a8a6019b/attachment.htm>
More information about the amber-dev
mailing list