Review request for JDK-8006984

A. Sundararajan sundararajan.athijegannathan at oracle.com
Mon Feb 25 19:08:10 PST 2013


Hi Andreas,

Yep, I wrote that "scriptpad" sample - as a demo for embedded Rhino in 
jdk6/7. Yes, when nashorn is changed to fix as per spec, I/we need to 
fix that sample to work on nashorn as well.

Function-declaration-to-expression fix needs to be done on this sample 
as well as other such script, if any, in jdk code/samples/docs.

-Sundar

On Tuesday 26 February 2013 12:33 AM, Andreas Rieber wrote:
> Hi Attila,
>
> i can't read that out of ecma-262 spec but i guess you read that many 
> times more than i did. I try to follow "The Good Pars", which would 
> make all easier.
>
> Is there a way to access the issue tracking? I mean it would make my 
> live easier. At the moment i follow every commit and try to get in but 
> i don't see what is open, coming, etc.
>
> cheers
> Andreas
>
> PS: if i am not totally wrong - that code was from Sundar.
>
>
> On 25.02.13 18:46, Attila Szegedi wrote:
>> Excellent…
>>
>> On that note, I want to make you aware that we'll soon make Nashorn 
>> reject with a syntax error those function declarations that occur 
>> within "with" and "catch" blocks; we're shooting for 100% ECMAScript 
>> 5.1 compliance, and it disallows function declarations except 
>> directly on the top-level of script and in another function's body. 
>> In such cases, you'll need to use a function expression instead. So 
>> this:
>>
>> var guiPkgs = { JFrame: function() { print("created"); } };
>>
>> with (guiPkgs) {
>>       function main() { // <---- this is not legal in ECMAScript 5.1
>>         var frame;
>>
>>         function createFrame() {
>>             frame = new JFrame();
>>         }
>>
>>         createFrame();
>>     }
>> }
>> main();
>>
>> will soon stop working. If you want the "main" function and whatever 
>> is in it to be affected by the with() block, you'll have to use a 
>> function expression instead like this:
>>
>> with (guiPkgs) {
>>       var main = function() { // <---- this expresses your actual 
>> intent, and is the only valid construct here in ES5.1
>>         var frame;
>>
>>         function createFrame() { // <-- this is still okay, as it's 
>> defined directly on the function body level of main()
>>             frame = new JFrame();
>>         }
>>
>>         createFrame();
>>     }
>> }
>> main();
>>
>> Attila.
>>
>> On Feb 25, 2013, at 6:37 PM, Andreas Rieber <rieberandreas at gmail.com 
>> <mailto:rieberandreas at gmail.com>> wrote:
>>
>>> Hi Attila,
>>>
>>> i found that fix and retested. One line more and another one... 
>>> couldn't break it ;-)
>>>
>>> Andreas
>>>
>>> On 25.02.13 16:36, Attila Szegedi wrote:
>>>> Second review request, now with the test: 
>>>> http://cr.openjdk.java.net/~attila/8006984/webrev.01/ 
>>>> <http://cr.openjdk.java.net/%7Eattila/8006984/webrev.01/>
>>>>
>>>> On Feb 25, 2013, at 3:43 PM, Attila Szegedi 
>>>> <attila.szegedi at oracle.com <mailto:attila.szegedi at oracle.com>> wrote:
>>>>
>>>>> Please review JDK-8006984 at 
>>>>> http://cr.openjdk.java.net/~attila/8006984/webrev.00 
>>>>> <http://cr.openjdk.java.net/%7Eattila/8006984/webrev.00>
>>>>>
>>>>> Thanks,
>>>>>  Attila.
>>
>



More information about the nashorn-dev mailing list