|
Josh @ Dreamland
|
|
Reply #16 Posted on: June 30, 2010, 04:50:16 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
The global accessor for foo invoked by V8 would access enigma::instance_event_iterator->inst, executing the code-generated fetch for foo, returning this->foo, thus far reading "old", and assign it to "new". The printed result would be "new".
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #18 Posted on: June 30, 2010, 08:10:44 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Luis's example didn't say var...
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #21 Posted on: July 01, 2010, 01:04:44 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Ah, right. I was focusing on the execute_string() part and managed to totally ignore his means of declaring it in the first place. In either case, the behavior is the same. V8 would have no way of accessing a temporarily created scope. So really, it will show "new" so long as neither have "var", in both ENIGMA and GM. So, yes, retep, that's exactly what it means.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #23 Posted on: July 01, 2010, 12:04:25 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
GM defaults to the instance scope. local. It also keeps lists of other scopes to check first. The first of those is the script scope, declared with "var". The second is the global scope, declared with "globalvar". Execute_string gets its own script scope, and so won't share a var declared in the calling scope. However, execute_string will also default to the calling instance scope if the variable isn't on either list.
var foo; will print "old". Just foo="old"; will print new.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #25 Posted on: July 01, 2010, 03:58:04 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Yep. And I refuse to have any ties whatsoever to VStudio. I figure Google will make it happen eventually.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #27 Posted on: July 01, 2010, 09:28:07 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Yahoo games only work in Internet Explorer. ...That's why my mother uses it.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
|