<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I understand your position and ten years ago I would agree with it wholeheartedly but not anymore. I am excited about JEP 445 and how it might bring more students and self learners
 to Java. Today’s learners want fast results. It is why I believe so many are hooked on Python. I dislike Python because it is an untyped language, but we cannot ignore that:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Python: loan = input("Loan: ")<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">makes more sense to those starting out than:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Java: var loan = Double.parseDouble(readln("Loan: "));<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Both will throw exceptions if you enter “bob” for the value, just at different points in the execution.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">I feel that any language should evolve not only with new features but in new ways to learn that match how people learn today. I do agree that there can easily be a flood of requests
 that could probably make Java look like GW-BASIC.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Thank you, Brian, for providing the summary of why you and the Java team decided not to have a numeric read. As they say, we will have to agree to disagree.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US">Ken<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> amber-dev <amber-dev-retn@openjdk.org>
<b>On Behalf Of </b>Brian Goetz<br>
<b>Sent:</b> November 7, 2024 2:41 PM<br>
<b>To:</b> Barry Burd <bburd@drew.edu>; amber-dev@openjdk.org<br>
<b>Subject:</b> Re: JEP 495 Question<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:13.5pt;font-family:"Courier New"">Yes, these were considered, and dismissed with prejudice, in part because the model implied by readInt and readDouble is a problematic one, because it
 greatly complicates the "reading state" that has to be understood by the user (e.g., what if there's no digits on the line, does it read another line?  what if the digits end mid-line, does it leave the cursor there?  what if it consumes all the characters
 on the line, and then you read a string?)  These are issues that invariably trip up beginners and experienced users alike. 
<br>
<br>
The locution you suggest, which is to use readln() to read a line into a String, then parseInt() to convert to an int, is more wordy than some of the alternatives, but much clearer and simpler as to what is going on, because it composes two simple functions
 (read a string, convert a string to an int).  This is good for beginners, because they can see that there are steps here to get the data into the form they want.  The readInt() method provides the illusion of simplicity, but ends up moving significant complexity
 to where we are more likely to trip over it in the dark.<br>
<br>
I'm not saying there will never be a richer way to do this, but readInt() and friends are definitely not it.<br>
<br>
More generally, one of the worst things about creating an IO class is that it immediately becomes  target for a flood of "can you just add my one favorite method" requests.  We might add a few more methods to it in the next decade.  But we also might not; less
 is more.<br>
<br>
</span><o:p></o:p></p>
<div>
<p class="MsoNormal">On 11/7/2024 12:06 PM, Barry Burd wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">I see that parameterless println() and readln() methods are being added to java.io.IO in JEP 495. I'm still wondering if there's been any thought to including methods like readInt and readDouble. In the early stage of an introduction to
 Java, it's common to have the student input int values and double values for simple examples. With the current spec, the best way to do this (as far as I can see) is
<br>
<br>
      var n = Integer.parseInt(readln("Enter a number")); <br>
<br>
It seems natural to simplify this with a readInt method, and the addition of such a method wouldn't weigh heavily on the java.io.IO package.
<br>
Any thoughts? <br>
  --Barry <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>