JEP 495 Question
Artyom Drozdov
artyomcool2 at gmail.com
Sat Nov 9 10:29:33 UTC 2024
Hello.
I would also add an argument to not add auto-import of IO.*.
It is easy to explain that IO states for input/output, and as a bonus
students will get a full list of available IO-methods from IDE suggests.
This may encourage them for self learning and won't introduce very special
magic for a very few methods.
Regards,
Artyom Drozdov
сб, 9 нояб. 2024 г., 11:03 Cay Horstmann <cay.horstmann at gmail.com>:
> I am with Stephen here.
>
> For effective learning, the gating factor is complexity, not verbosity.
> The regularity of IO.println wins over the implicit import.
>
> Who are we trying to help with "import static java.io.IO.*"?
>
> * It's not useful for beginning Java learners.
> * It might be useful for advocates to say "look, the canonical Hello World
> in Java is pretty much like the one in Python". Of course, it really isn't,
> and removing three letters won't change that.
> * It is mildly useful for people (like me) who use Java for scripting
> tasks.
>
> I am ok with saying "we want Java to be great for tasks of all sizes, and
> therefore give you unqualified println, print, readln. Even though we know
> that is yet another fiddly thing for learners to absorb". Everything is a
> tradeoff.
>
> But let's not pretend it makes the language easier to learn. It doesn't.
>
> Cheers,
>
> Cay
>
>
> On 08/11/2024 10:20, Stephen Colebourne 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
>
> --
>
> Cay S. Horstmann | https://horstmann.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20241109/e6304789/attachment.htm>
More information about the amber-dev
mailing list