|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
DMDScript - Walter - can you please look into this? Thanks!
It's kind of a scope issue. Here is the test java script:
var Util = {
bar: function() {
function it() {
return "I'm in it()";
}
function g() {
println("This is bar! - " + it());
}
g();
}
}
Util.bar();
It runs well on IE & Mozilla but failed on your JS engine which reports
"property [it] is undefined and no call method". I've to add 'this' in front of
it() to make it work. But I think this is not necessary since function it() is
defined in the same scope as function g(). It seems like it() will only look for
global scope if there is no 'this' in front of it.
Can you please expain the details and point me a way to solve this issue since
we found many scripts on web will not have 'this' when refer to an inner
function.
Thanks!
Dec 07 2005
"adzheng" <adzheng_member pathlink.com> wrote in message news:dn7umc$2pal$1 digitaldaemon.com... Dec 08 2005
Thank you, Walter, for your quick reply. In order to be consistent with other scripts which run well on IE&Mozilla we've to find a way to solve this issue and we did it. Here are some evidence found on web: http://www.webreference.com/js/column80/6.html You can see that in the section on scope, it says: ------------------------------------------------ Function code is code in the body of a function. The scope of function code is not trivial. It includes: * The variable object of the calling code's execution context. This object includes all variables that were defined up to the point where the function (or its outer function) is called. * The variable object of the outer function, if there is an outer function. * The global object which is the browser window object. * The arguments object which includes all passed parameter values. The 2nd asterisk stands the point. Anyway, thanks a lot for your help. We probably need your help to solve other problems in the future! In article <dnb7ah$3pc$1 digitaldaemon.com>, Walter Bright says..."adzheng" <adzheng_member pathlink.com> wrote in message news:dn7umc$2pal$1 digitaldaemon.com... Dec 09 2005
"adzheng" <adzheng_member pathlink.com> wrote in message news:dnckk9$2tp8$1 digitaldaemon.com...Here are some evidence found on web: http://www.webreference.com/js/column80/6.html Dec 09 2005
"adzheng" <adzheng_member pathlink.com> wrote in message news:dnckk9$2tp8$1 digitaldaemon.com...In order to be consistent with other scripts which run well on IE&Mozilla Dec 09 2005
In fact we modified the scope chain. In article <dncn6k$30e$2 digitaldaemon.com>, Walter Bright says..."adzheng" <adzheng_member pathlink.com> wrote in message news:dnckk9$2tp8$1 digitaldaemon.com...In order to be consistent with other scripts which run well on IE&Mozilla Dec 16 2005
Can you post the diffs? "adzheng" <adzheng_member pathlink.com> wrote in message news:dnvnde$2vpi$1 digitaldaemon.com...In fact we modified the scope chain. In article <dncn6k$30e$2 digitaldaemon.com>, Walter Bright says..."adzheng" <adzheng_member pathlink.com> wrote in message news:dnckk9$2tp8$1 digitaldaemon.com...In order to be consistent with other scripts which run well on IE&Mozilla Dec 19 2005
Here is the code snip. Please let me know your opinion. Thanks! So far we haven't found any side effects. unsigned scoperootsave; case IRcallscope: // a = s(argc, argv) ... scoperootsave = cc->scoperoot; cc->scoperoot = scope->dim; ... cc->scoperoot = scoperootsave; In article <do74c9$1gj9$1 digitaldaemon.com>, Walter Bright says...Can you post the diffs? "adzheng" <adzheng_member pathlink.com> wrote in message news:dnvnde$2vpi$1 digitaldaemon.com...In fact we modified the scope chain. In article <dncn6k$30e$2 digitaldaemon.com>, Walter Bright says..."adzheng" <adzheng_member pathlink.com> wrote in message news:dnckk9$2tp8$1 digitaldaemon.com...In order to be consistent with other scripts which run well on IE&Mozilla Dec 22 2005
|