<div dir="ltr"><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">First of all, thank you all for taking the time to review the proposal and sharing your valuable opinions. I would like to note that the proposal aims not to add a new capability that was not possible to do before but rather move the standard forward on the way for a modern, better and easier to use language for all the developers. Advancements of the language, or any language in that matter, throughout the last decade also followed a similar path because we were already able to do everything in one way or the other. We actually strive for the same thing, a better Javascript.</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">That being said, l</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">et me try to clarify my proposal further by walking you through my thought process:</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">Normally if I try to write a class similar to the sample code I have given in my first email using an object oriented programming language like Java, C# etc., I would be writing something similar to the following:</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">   </span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">class</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="font-family:Consolas;color:rgb(43,145,175);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">RequestManager</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    {</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">string</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> successMessage = </span><span style="font-family:Consolas;color:rgb(163,21,21);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">"Xhr successful."</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">;</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">void</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> makeRequest()</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        {</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">            </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">var</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> oReq = </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">new</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> XMLHttpRequest();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">            oReq.addEventListener(</span><span style="font-family:Consolas;color:rgb(163,21,21);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">"load"</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">, responseHandler);</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">            oReq.open(</span><span style="font-family:Consolas;color:rgb(163,21,21);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">"GET"</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">, </span><span style="font-family:Consolas;color:rgb(163,21,21);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">"</span><a href="#inbox/_blank"><u><span class="gmail-15" style="font-family:Consolas;letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">www.google.com</span></u></a><span style="font-family:Consolas;color:rgb(163,21,21);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">"</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">);</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">            oReq.send();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        </span><span style="font-family:Consolas;color:rgb(0,0,255);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">void</span><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> responseHandler()</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        {</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">            window.alert(successMessage);</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Consolas;color:rgb(0,0,0);letter-spacing:0pt;font-size:9.5pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">As you can see, I do not even have to use a special keyword for referring to methods from inside the class. </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">Because they are already in lexical scope. </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">Now, if this can be accomplished in Javascript without hitting some limitation/restriction due to the current state of the language, I think it would be the ideal solution. (This limitation might be the class syntax being just a syntactical sugar or some other reason</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> that I cannot foresee right now and that would require a breaking change</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">.)</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> And I would happily change the proposal that way: “A no-keyword alternative for the “this””. If I should summarize this approach, I can say that every method of the class is going to assume the behavior we now have with arrow functions, but without requiring the use of the “this” and the arrow function syntax.</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">As contrary to the ideal solution, the last thing I would want would be to use a context-dependant keyword like </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">the </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">“this” to refer to methods/properties of the object and then try to set the context right by using binding or arrow functions. This referral should be lexical, not context-dependant. If I have the intent of referring to the instance method/property, that intent should manifest itself right there where I am using this method/property. I shouldn’t be looking at if this takes place inside an ar</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">r</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">ow function, or if the enclosing method is called with a binding or not.</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> Why should I care about the enclosing of the call, right?</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">By the way</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">, MDN also </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">mentions the following about the use of arrow functions</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">: </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">“Arrow function expressions are ill suited as methods”.</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><b style="text-indent:0pt"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">@Yulia:</span></b><span style="text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;letter-spacing:0pt;font-size:11pt"> Thanks for pointing out the decorator </span><span style="text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;letter-spacing:0pt;font-size:11pt">approach</span><span style="text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;letter-spacing:0pt;font-size:11pt">. But that also seems to deal with the enclosing and tries to solve the problem with a “context binding” approach. The only difference is the way it determines the binding. I am against this binding approach all together. Only the lexical scope of the code should be taken into consideration.</span><br></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Arial;color:rgb(51,51,51);letter-spacing:-0.05pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">So far</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">,</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> I have la</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">i</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">d out what I think the ideal solution is and what I think the problematic state we are in right now. And as a middle</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">-</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">ground, in case the ideal solution cannot be applied, I proposed a new keyword to use instead of the “this” so that it will always refer to the instance</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">, regardless of execution context binding</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">. In which case, when you replace the “this” in the problematic sample code in my initial email, it will work just fine. Let’ assume for the sake of this example that the new keyword is “self”:</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Arial;color:rgb(51,51,51);letter-spacing:-0.05pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">class RequestManager{</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    constructor(){</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        </span><b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">self</span></b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">.successMessage = "Xhr successful.";</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    makeRequest() {</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        var oReq = new XMLHttpRequest();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        oReq.addEventListener("load",</span><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">self</span></b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">.responseHandler);</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        oReq.open("GET", "</span><a href="#inbox/_blank"><u><span class="gmail-15" style="font-family:Consolas;letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">www.google.com</span></u></a><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">");</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        oReq.send();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    responseHandler() {</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">        window.alert(</span><b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">self</span></b><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">.successMessage);</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">    }</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">}</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">var reqManager = new RequestManager();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt;text-indent:0pt;background:rgb(246,248,250);font-family:Calibri"><span style="font-family:Consolas;color:rgb(36,41,46);letter-spacing:0pt;font-size:9pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reqManager.makeRequest();</span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="font-family:Arial;color:rgb(51,51,51);letter-spacing:-0.05pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span><span style="letter-spacing:0pt;font-size:11pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">As you can see, self.responseHandler will always point to the responseHandler method no matter whether the enclosing is a method, an arrow function or if it is called using a bind syntax or not. </span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></p><p class="MsoNormal" style="margin:0pt 0pt 8pt;text-indent:0pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Calibri"><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">I would be happy to further address your concerns about this explanation if you have any.</span><span style="letter-spacing:0pt;font-size:11pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;font-family:Calibri"> </p></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 10, 2019 at 10:30 PM guest271314 <<a href="mailto:guest271314@gmail.com">guest271314@gmail.com</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"><div dir="ltr"><div dir="ltr">This is probably not the pattern that is being proposed though outputs the expected result<div><br></div><div><div>    ```class RequestManager {</div><div>      constructor() {</div><div>        this.successMessage = "Xhr successful.";</div><div>        RequestManager.THIS = this;</div><div>      }</div><div><br></div><div>      makeRequest() {</div><div>        var oReq = new XMLHttpRequest();</div><div>        oReq.addEventListener("load", this.responseHandler);</div><div>        oReq.open("GET", "");</div><div>        oReq.send();</div><div>      }</div><div><br></div><div>      responseHandler(e) {</div><div>        console.log(e, this); // `e`: event, `this`: XMLHttpRequest instance</div><div>        console.log(RequestManager.THIS.successMessage);</div><div>      }</div><div><br></div><div>    }</div><div><br></div><div>    var reqManager = new RequestManager();</div><div><br></div><div>    reqManager.makeRequest();```</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 9, 2019 at 11:42 AM john larson <<a href="mailto:johnlarsondev1@gmail.com" target="_blank">johnlarsondev1@gmail.com</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"><div dir="ltr"><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"><b style="font-size:11pt"><u>Summary of the problem:</u></b><br></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">“this” keyword in Javascript is context dependent. And this is one of the culprits of most subtle and latent errors in Javascript. Moreover, use of “this” cannot be avoided if we are using classes and trying to reference instance properties.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">When “this” is used in callback functions or in functions given to forEach as argument, IDEs rightfully cannot raise any design-time errors, giving developers the false sense of security, but we get run-time errors because “this” is undefined.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">There seem to be two work-arounds:</p><p class="gmail-m_-8918587750585472385gmail-m_-8001099771182452640gmail-m_-1339185979708762546gmail-m_-8854047637254780782gmail-MsoListParagraphCxSpFirst" style="margin:0in 0in 0.0001pt 0.5in;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">1.<span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"Times New Roman"">      </span>Using arrow functions</p><p class="gmail-m_-8918587750585472385gmail-m_-8001099771182452640gmail-m_-1339185979708762546gmail-m_-8854047637254780782gmail-MsoListParagraphCxSpLast" style="margin:0in 0in 8pt 0.5in;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">2.<span style="font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:7pt;line-height:normal;font-family:"Times New Roman"">      </span>Using .bind(this) syntax</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">Just assuming we forgot to use an arrow function or a .bind(), the IDE will not be able to raise an error and we will encounter the error in run-time.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"><b><u>What I propose:</u></b></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">I am proposing a new keyword that will be the alternative of "this" and will always point to the instance of the class. The name of the new keyword can be chosen with consensus from the community such that it would minimize/eliminate collision in existing codebases.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">Here is a sample js code:</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">class RequestManager{</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    constructor(){</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        this.successMessage = "Xhr successful.";</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    }</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    makeRequest() {</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        var oReq = new XMLHttpRequest();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.addEventListener("load", this.responseHandler);</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.open("GET", "<a href="http://www.google.com/" target="_blank">www.google.com</a>");</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.send();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    }</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    responseHandler() {</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        window.alert(this.successMessage);</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    }</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">}</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">var reqManager = new RequestManager();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">reqManager.makeRequest();</span></code><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46)"></span></pre><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">This piece of code will alert “undefined” because “this” is undefined in the callback function in strict mode.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">Now let’s assume a new keyword is used insetead of “this” that will always point to the class instance.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">As per its implementation, as described on <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes" style="color:rgb(5,99,193)" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes</a>:</p><p class="MsoNormal" style="margin:0in 0in 8pt 0.5in;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"><i><span style="font-family:Arial,sans-serif;color:rgb(51,51,51);letter-spacing:-0.05pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">“</span>JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.”</i><i><span style="font-family:Arial,sans-serif;color:rgb(51,51,51);letter-spacing:-0.05pt;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></i></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">So with the new keyword introduced, behind the scenes, previous class could be interpreted as a piece of code along the lines of:</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">var RequestManager = function () {</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    var self = this;</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    self.successMessage = "Xhr successful";</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    self.makeRequest = function () {</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        var oReq = new XMLHttpRequest();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.addEventListener("load", responseHandler);</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.open("GET", "<a href="http://www.google.com/" target="_blank">www.google.com</a>");</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        oReq.send();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    };</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    var responseHandler = function () {</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">        window.alert(self.successMessage);</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">    };</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">};</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">var reqManager = new RequestManager();</span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in"> </span></code></pre><pre style="white-space:pre-wrap;background:rgb(246,248,250);margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><code style="font-family:"Courier New""><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46);border:1pt none windowtext;padding:0in">reqManager.makeRequest();</span></code><span style="font-size:9pt;font-family:Consolas;color:rgb(36,41,46)"></span></pre><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10.5pt;line-height:14.98px;font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"> </span></p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">I believe this way, we would not have to resort to work-arounds for such a fundamental construct of the language and this would ease developers’ lives as someone forgetting to have used an arrow function or the .bind(this) syntax will not be a problem anymore.</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif"> </p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">Best Regards,</p><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:15.6933px;font-size:11pt;font-family:Calibri,sans-serif">John</p></div><div id="gmail-m_-8918587750585472385gmail-m_-8001099771182452640gmail-m_-1339185979708762546DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid rgb(211,212,222)">
        <tbody><tr>
        <td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
                <td style="width:470px;padding-top:12px;color:rgb(65,66,78);font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link" style="color:rgb(68,83,234)" target="_blank">www.avast.com</a>
                </td>
        </tr>
</tbody></table><a href="#m_-8918587750585472385_m_-8001099771182452640_m_-1339185979708762546_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>
_______________________________________________<br>
es-discuss mailing list<br>
<a href="mailto:es-discuss@mozilla.org" target="_blank">es-discuss@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/es-discuss</a><br>
</blockquote></div>
</blockquote></div>