JEP 495 Question

Olexandr Rotan rotanolexandr842 at gmail.com
Fri Nov 8 09:32:43 UTC 2024


I feel like I have to disagree here. "Growing" is not about jumping from
console calculator to spring boot aot compiled microservices with
distributed tracing and other buzzwords. It is about jumping from one-file
console calculator to n-files console calculator, assume on the stage of
introducing packages and imports.

 IO will be used in production as often as System.console() (never, I would
say), because modern logging and debug tools are just more convenient. All
of this is my opinion, I am not stating it as a fact, hovewer I am strongly
convinced in all of the above.

And once again, production code is completely different world, and anything
that is locked inside classes a that are not even allowed to have a package
is not going to have any affect on people that are getting familiar with
modern web, just because of how far this points are in learning path

On Fri, Nov 8, 2024, 11:21 Stephen Colebourne <scolebourne at joda.org> wrote:

> On Thu, 7 Nov 2024 at 21:10, Brian Goetz <brian.goetz at oracle.com> wrote:
> > Here's the bar we're envisioning: methods that are automatically
> imported in this way _effectively become part of the langauge_.  The bar
> for that is very high.
>
> Making a method like readInt() "effectively part of the language" is
> clearly wrong. And therefore obvious why it should be rejected.
> But maybe the answer is to take a step back and reconsider whether the
> "automatically imported" part of the sentence is a bad choice (which
> therefore nullifies the "effectively become part of the language"
> claim, effectively allowing readInt and friends).
>
> The JEP ("Growing a program" section) asks users that migrate from a
> simple source file to a normal one to add two imports:
>   import static java.io.IO.*
>   import module java.base
>
> I'm OK with `import module java.base`, but I'm afraid I think `import
> static java.io.IO.*` is a really terrible idea. Most production code
> should not be using the console at all, it should be using some kind
> of logging system. System.out is a hack. IMO, the "growing the
> language" approach described in the JEP will end up over time
> normalising console output in the minds of developers, with a negative
> effect on production Java code.
>
> Given this, and working backwards (IMO):
> - Encouraging `import static java.io.IO.*` is a Really Bad Idea
> - Therefore migrating from simple source file should therefore only
> require `import module java.base`
> - Therefore, simple source files should use IO.println(String), not
> just println(String)
> - Therefore, more methods can be freely added to IO, like readInt()
>
> Yes, yes, yes. I know. `IO.println(String)` is more complex than just
> `println(String)` for a beginner. But is it really that bad for a
> beginner given the risk of normalising console usage?
>
> Stephen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20241108/e90902d4/attachment-0001.htm>


More information about the amber-dev mailing list