JEP 477 Interacting with the Console

Cay Horstmann cay at horstmann.com
Tue Jul 16 07:15:30 UTC 2024


On 16/07/2024 08.41, Remi Forax wrote:
>> In general, the needs of beginners and authors of small programs are not the
>> same. The JEP bounces between the needs of the two. Implicit classes are useful
>> for both, but magic imports will add puzzlement for beginners.
> 
> I disagree, this is only an issue if you talk about "import", seing println as a shorcut for IO.println is not a real problem.
> 
> The notion of "import" in Java is tricky anyway especially because most of my students know Python so you need a full lesson about the difference between Java import and Python import,
> but that lesson can be taught in the second part of the semester when you need "package".
> 

Hi Rémi,

I agree that not having to talk about imports right away is a win. I am all for importing java.base.

I am not sure I get your point about shortcuts, though. I wouldn't want to talk about shortcuts any more than about imports. I would not want to discuss why there is a println shortcut but not parseInt or pow.

Really, how painful is IO.println? (If that's too long, call it IO.out.) And it is consistent. IO.println. Integer.parseInt. Math.pow. Consistent is good for beginners. If further brevity is desired, there is an existing mechanism--static imports. Which can wait.

The alternative is to go big, and to provide "shortcuts" for all beginner methods. println, parseInt, pow. Consistent and not puzzling. But of course the rub is, what are all beginner methods?

Cheers,

Cay

--

Cay S. Horstmann | https://horstmann.com


More information about the amber-dev mailing list