<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div>I don't see how fields and locals are more easily distinguished by the presence of a class declaration around them — in both cases, things not inside the method belong to an outer scope — nor do I understand why you’d want to emphasise the “instanceness”
of an implicit class instance by highlighting `this`. But what I think doesn’t matter; I’m sure that you teach well, and if you don’t want to teach fields before teaching classes — don’t. But I don’t think that your style, however effective, is universal among
teachers. Some even avoid teaching OOP in the first term.</div>
<div><br class="">
</div>
<div>I think the criteria for judging this change are:</div>
<div><br class="">
</div>
<div>1. Does it promote a “bad" programming style that would later be discouraged?</div>
<div>2. Does it give teachers significantly more freedom to teach how they choose and addresses the particular problems teachers have complained about?</div>
<div>3. Is it a natural extension of Java?</div>
<div><br class="">
</div>
<div>I think that you agree that the answer to 1 is no and the answers to 2 and 3 is yes, but you point out that some styles of teaching may not be helped by every aspect of the change. I could agree with you completely yet still not see why it matters, unless
there’s a way to allow *all* reasonable teaching styles while reducing possible confusion further. I don’t think that disallowing fields achieves that. For one, it makes defining constants very hard. For another, there are valid uses even of mutable shared
variables that don’t involve classes. I don’t see how we can help one valid teaching style without harming another or making the feature less natural (e.g. it’s possible that making all members of an implicit class static would make some things easier, but
it would harm the gradual-growth goal).</div>
<div><br class="">
</div>
<div>Implicit classes are not meant as a “subset of Java for teaching”. They’re a mechanism that allows teachers to choose what parts of Java they want to teach and when (and allows Java veterans to write small programs more pleasantly). In particular, it allows
teachers such as yourself to choose when to introduce fields.</div>
<div><br class="">
</div>
<div>— Ron</div>
<div><br class="">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 21 Feb 2023, at 07:09, <a href="mailto:forax@univ-mlv.fr" class="">
forax@univ-mlv.fr</a> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="caret-color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="Apple-interchange-newline">
<br class="">
</div>
<hr id="zwchr" data-marker="__DIVIDER__" style="caret-color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div data-marker="__HEADERS__" style="caret-color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<b class="">From:<span class="Apple-converted-space"> </span></b>"Brian Goetz" <<a href="mailto:brian.goetz@oracle.com" class="">brian.goetz@oracle.com</a>><br class="">
<b class="">To:<span class="Apple-converted-space"> </span></b>"Remi Forax" <<a href="mailto:forax@univ-mlv.fr" class="">forax@univ-mlv.fr</a>><br class="">
<b class="">Cc:<span class="Apple-converted-space"> </span></b>"Ron Pressler" <<a href="mailto:ron.pressler@oracle.com" class="">ron.pressler@oracle.com</a>>, "Dan Heidinga" <<a href="mailto:heidinga@redhat.com" class="">heidinga@redhat.com</a>>, "amber-spec-experts"
<<a href="mailto:amber-spec-experts@openjdk.org" class="">amber-spec-experts@openjdk.org</a>><br class="">
<b class="">Sent:<span class="Apple-converted-space"> </span></b>Tuesday, February 21, 2023 12:33:31 AM<br class="">
<b class="">Subject:<span class="Apple-converted-space"> </span></b>Re: Implicit Record Was: JEP draft: Implicit Classes and Enhanced Main Methods (Preview)<br class="">
</blockquote>
</div>
<div data-marker="__QUOTED_TEXT__" style="caret-color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<font size="4" class=""><font face="monospace" class="">You seem to have a very strange notion of what "works" means. These all work just fine. No one is suggesting that local and "shared" variables are unified. If you find it confusing to teach fields early,
then wait -- that's one of the choices. <span class="Apple-converted-space"> </span><br class="">
</font></font><br class="">
<blockquote class="">
<div class="">Scope rules are different, being static is different, initialization rules are different, inference rules are different, even colors in IDEs are different.<br class="">
</div>
</blockquote>
<br class="">
Correct, and well understood. Your point? <span class="Apple-converted-space"> </span></blockquote>
<div class=""><br class="">
</div>
<div class="">Implicit class remove the "class" shell, so you now have two syntactically identical things that are semantically different.</div>
<div class="">IMO, introducing dangling fields, a new feature in Java, does not worth the confusion it creates.<br data-mce-bogus="1" class="">
</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<br class="">
<br class="">
<blockquote class="">
<div class="">You did, by re-using the term "variables" for both local variable and fields.<br class="">
</div>
</blockquote>
<br class="">
Sorry, no. They are both variables, but they are different sorts. Just like "instance vs static" variables, or "final vs mutable" variables. They are all variables (they have a name, and a type, and hold a value), and yet they each have different characteristics
(and the characteristics can be combined; you can have shared final static variables, and local mutable variables, and....)<br class="">
<br class="">
I think you're taking a "I would prefer it work this way" and bootstrapping it into "the alternative is broken" (that's what "doesn't work" means.) You should know by now that this is the best way to not have your arguments taken seriously! <span class="Apple-converted-space"> </span></blockquote>
<div class=""><br class="">
</div>
<div class="">I think you are talking about variable in general, i'm focused on local variable and fields in the context of implicit class, hence the difficulty to understand each other.<br class="">
</div>
<div class="">Implicit class makes the syntax of fields identical to the syntax of local variables and at the same time, the way to differentiate then is to explain what an implicit class is.</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<div class="">Again, i'm not against the notion of implicit container, i just think that implicit record makes more sense than implicit class, and i would like we discuss about that,<br data-mce-bogus="1" class="">
</div>
<div class="">here is example where the container leaks,<br data-mce-bogus="1" class="">
</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<div class=""> void main() {<br data-mce-bogus="1" class="">
</div>
<div class=""> System.out.println(this);<br data-mce-bogus="1" class="">
</div>
<div class=""> }<br data-mce-bogus="1" class="">
</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<div class="">what it should print ?<br data-mce-bogus="1" class="">
</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<div class="">regards,<br data-mce-bogus="1" class="">
</div>
<div class="">Rémi<br data-mce-bogus="1" class="">
</div>
<div class=""><br data-mce-bogus="1" class="">
</div>
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<br class="">
<br class="">
<br class="">
<br class="">
<div class="moz-cite-prefix">On 2/20/2023 4:38 PM,<span class="Apple-converted-space"> </span><a class="moz-txt-link-abbreviated" href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a><span class="Apple-converted-space"> </span>wrote:<br class="">
</div>
<blockquote cite="mid:1063786217.26511085.1676929092386.JavaMail.zimbra@u-pem.fr" class="">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class="">
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<hr id="zwchr" class="">
<div class="">
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<b class="">From:<span class="Apple-converted-space"> </span></b>"Brian Goetz"<span class="Apple-converted-space"> </span><a class="moz-txt-link-rfc2396E" href="mailto:brian.goetz@oracle.com" target="_blank"><brian.goetz@oracle.com></a><br class="">
<b class="">To:<span class="Apple-converted-space"> </span></b>"Remi Forax"<span class="Apple-converted-space"> </span><a class="moz-txt-link-rfc2396E" href="mailto:forax@univ-mlv.fr" target="_blank"><forax@univ-mlv.fr></a><br class="">
<b class="">Cc:<span class="Apple-converted-space"> </span></b>"Ron Pressler"<span class="Apple-converted-space"> </span><a class="moz-txt-link-rfc2396E" href="mailto:ron.pressler@oracle.com" target="_blank"><ron.pressler@oracle.com></a>, "Dan Heidinga"<span class="Apple-converted-space"> </span><a class="moz-txt-link-rfc2396E" href="mailto:heidinga@redhat.com" target="_blank"><heidinga@redhat.com></a>,
"amber-spec-experts"<span class="Apple-converted-space"> </span><a class="moz-txt-link-rfc2396E" href="mailto:amber-spec-experts@openjdk.org" target="_blank"><amber-spec-experts@openjdk.org></a><br class="">
<b class="">Sent:<span class="Apple-converted-space"> </span></b>Monday, February 20, 2023 9:33:34 PM<br class="">
<b class="">Subject:<span class="Apple-converted-space"> </span></b>Re: Implicit Record Was: JEP draft: Implicit Classes and Enhanced Main Methods (Preview)<br class="">
</blockquote>
</div>
<div class="">
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<br class="">
<blockquote cite="mid:235253077.26502897.1676924374598.JavaMail.zimbra@u-pem.fr" class="">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">As i said earlier, it does not work because fields and local variables have different semantics,<br class="">
</div>
<div class="">fields are initialized with a default value while local variables need to be initialized before use.<br class="">
</div>
<div class="">So the curtain is just a veil that will be pierced by any students moving declarations around.</div>
</div>
</div>
</blockquote>
<br class="">
Of course it "works", it just might not work how you would prefer it to.</blockquote>
<div class=""><br class="">
</div>
<div class=""> var greetings = 0;<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">does not work,<br class="">
</div>
<div class=""><br class="">
</div>
<div class=""> void main() {<br class="">
</div>
<div class=""> int greetings;<br class="">
</div>
<div class=""> System.out.println(greetings);<br class="">
</div>
<div class=""> }<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">does not work,<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""> void main() {</div>
<div class=""> static int greetings;</div>
<div class=""> System.out.println(greetings);</div>
<div class=""> }</div>
<div class=""><br class="">
</div>
<div class="">does not work,</div>
</div>
<div class=""><br class="">
</div>
<div class=""> void main() {<br class="">
</div>
<div class=""> int greetings = 0;<br class="">
</div>
<div class=""> for(;;) {<br class="">
</div>
<div class=""> int greetings = 0;<br class="">
</div>
<div class=""> }<br class="">
</div>
<div class=""> }<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">does not work too.<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Scope rules are different, being static is different, initialization rules are different, inference rules are different, even colors in IDEs are different.<br class="">
</div>
<div class=""><br class="">
</div>
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<span class="Apple-converted-space"> </span><br class="">
<br class="">
Prior to learning about fields, the user can perceive local variables (declared in a method) and "shared" variables (accessible to all members of the class.) They can learn about their characteristics. Then, when they learn about classes and fields and accessibility,
they can learn that the variables they were calling "shared" are really fields. The distinction between locals and fields is there from the beginning, though for most use cases, they will not notice the difference. When they're ready to learn the fine differences,
there's not anything to unlearn. <span class="Apple-converted-space"> </span><br class="">
<br class="">
<blockquote cite="mid:235253077.26502897.1676924374598.JavaMail.zimbra@u-pem.fr" class="">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;" class="">
<div class="">
<div class="">From my personal experience, unifying local variable and field leads to more pain than gain, mostly because local<span class="Apple-converted-space"> </span></div>
</div>
</div>
</blockquote>
<br class="">
Who said anything about unification of fields and locals? Where did you get such an idea that this is what is being proposed? <span class="Apple-converted-space"> </span></blockquote>
<div class=""><br class="">
</div>
<div class="">You did, by re-using the term "variables" for both local variable and fields.<br class="">
</div>
<div class=""><br class="">
</div>
<blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-size: 12pt;" class="">
<br class="">
<br class="">
First students will learn about statements. Then they will probably learn about local variables. They can be taught that they disappear when the method exits, and each invocation of the method gets a fresh copy. Then they can learn about multiple methods,
and then that there are variables that can be shared across methods and retain their values across method invocations, and while their declaration syntax is the same (they're both variables, after all), the _place_ in which they are declared is different (which
is what makes them shared), and shared variables have slightly different characteristics (though not so different they have to learn this immediately). They can learn the characteristics of shared variables when it makes sense to teach this. And when the
curtain is pulled back, they learn all fields have the characteristics of these shared variables. <span class="Apple-converted-space"> </span></blockquote>
<div class=""><br class="">
</div>
<div class="">Record components behave as you said, they have slightly different characteristics than local variables and it's hard to not notice the difference syntactically.<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">record Hello(String name) {<br class="">
</div>
<div class=""> void hello() {<br class="">
</div>
<div class=""> System.out.println("hello " + name);<br class="">
</div>
<div class=""> }<br class="">
</div>
<div class=""><br class="">
</div>
<div class=""> void bonjour() {<br class="">
</div>
<div class=""> System.out.println("bonjour " + name);<br class="">
</div>
<div class=""> }<br class="">
</div>
<div class="">}<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Class fields are far more different than just the lifetime but have a very similar syntax.</div>
<div class=""><br class="">
</div>
<div class="">Rémi</div>
</div>
</div>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>