<div dir="ltr">I still am not for importing java.base, for the reasons I think I talked to death in that other thread.<br><br>I guess while we are on the topic, what is the rationale behind naming the method <font face="monospace">println</font><font face="arial, sans-serif">?</font><div><font face="arial, sans-serif"><br></font></div><div>The current draft on github has <font face="monospace">println</font>, <font face="monospace">print</font>, and <font face="monospace">readln</font><font face="arial, sans-serif">. But printing isn't the inverse of reading - writing is the inverse of reading. I agree that the metaphor of "printing to the screen" is used widely, but I don't see why we would pick that given a blank slate.<br><br>Then also </font><font face="monospace">readln</font><font face="arial, sans-serif"> over </font><font face="monospace">readLine</font><font face="arial, sans-serif"> strikes me as a strange tradeoff. That's the kind of thing that helps someone who already knows that "ln" is an abbreviation for "line" write code - i.e. the group Cay identified as "</font>authors of small programs." For beginners it's one more non-obvious thing that needs to be explained.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 16, 2024 at 12:43 PM <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">----- Original Message -----<br>
> From: "Cay Horstmann" <<a href="mailto:cay@horstmann.com" target="_blank">cay@horstmann.com</a>><br>
> To: "Remi Forax" <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>><br>
> Cc: "amber-dev" <<a href="mailto:amber-dev@openjdk.org" target="_blank">amber-dev@openjdk.org</a>><br>
> Sent: Tuesday, July 16, 2024 9:15:30 AM<br>
> Subject: Re: JEP 477 Interacting with the Console<br>
<br>
> On 16/07/2024 08.41, Remi Forax wrote:<br>
>>> In general, the needs of beginners and authors of small programs are not the<br>
>>> same. The JEP bounces between the needs of the two. Implicit classes are useful<br>
>>> for both, but magic imports will add puzzlement for beginners.<br>
>> <br>
>> I disagree, this is only an issue if you talk about "import", seing println as a<br>
>> shorcut for IO.println is not a real problem.<br>
>> <br>
>> The notion of "import" in Java is tricky anyway especially because most of my<br>
>> students know Python so you need a full lesson about the difference between<br>
>> Java import and Python import,<br>
>> but that lesson can be taught in the second part of the semester when you need<br>
>> "package".<br>
>> <br>
> <br>
> Hi Rémi,<br>
> <br>
> I agree that not having to talk about imports right away is a win. I am all for<br>
> importing java.base.<br>
> <br>
> I am not sure I get your point about shortcuts, though. I wouldn't want to talk<br>
> about shortcuts any more than about imports. I would not want to discuss why<br>
> there is a println shortcut but not parseInt or pow.<br>
<br>
Shorcuts is not the right term, convenient is a better term.<br>
This is the word we use to explain "var" too.  <br>
<br>
> <br>
> Really, how painful is IO.println? (If that's too long, call it IO.out.) And it<br>
> is consistent. IO.println. Integer.parseInt. Math.pow. Consistent is good for<br>
> beginners. If further brevity is desired, there is an existing<br>
> mechanism--static imports. Which can wait.<br>
<br>
I think this is perfectly fine to not use "println" but "IO.println" instead and mention later that it can be abbreviated to "println".<br>
<br>
> <br>
> The alternative is to go big, and to provide "shortcuts" for all beginner<br>
> methods. println, parseInt, pow. Consistent and not puzzling. But of course the<br>
> rub is, what are all beginner methods ?<br>
<br>
and the fact that all these names polute the scope.<br>
<br>
We have exercises where students rewrite simple functions like pow or parseInt, it would be sad if IO.parseInt is called instead of the method "parseint" defined by a student because the method call is written "parseInt(...)".<br>
<br>
> <br>
> Cheers,<br>
> <br>
> Cay<br>
<br>
regards,<br>
Rémi<br>
<br>
> <br>
> --<br>
> <br>
> Cay S. Horstmann | <a href="https://horstmann.com" rel="noreferrer" target="_blank">https://horstmann.com</a><br>
</blockquote></div>