<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JavaScript: Variable declarations and scope</title>
	<atom:link href="http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/feed/" rel="self" type="application/rss+xml" />
	<link>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/</link>
	<description>Web, Dojo, news</description>
	<lastBuildDate>Wed, 28 Jul 2010 14:16:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jack Tanner</title>
		<link>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/comment-page-1/#comment-1078</link>
		<dc:creator>Jack Tanner</dc:creator>
		<pubDate>Wed, 14 Jul 2010 20:44:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.uxebu.com/?p=864#comment-1078</guid>
		<description>This is called &#039;hoisting&#039; the declaration.

For example, see http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting</description>
		<content:encoded><![CDATA[<p>This is called &#8216;hoisting&#8217; the declaration.</p>
<p>For example, see <a href="http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting" rel="nofollow">http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tjerk Wolterink</title>
		<link>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/comment-page-1/#comment-629</link>
		<dc:creator>Tjerk Wolterink</dc:creator>
		<pubDate>Sat, 09 Jan 2010 14:37:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.uxebu.com/?p=864#comment-629</guid>
		<description>Ah nice, i knew about function scope but i did not new about the javascript interpreter checking all declaration before execution.  Again it&#039;s all about semantics, that&#039;s why a specification is so important. Too bad the ecmascript specifications are written in plain text. This increases the chances of different interpretations and ambiguity.

For example what do you think the value of x is after running this code?

var b=10;
var f=function() {
 var b=5;
 function g() {
  var b=8;
  return this.b;
 }
 return g();
};
var x = f();

Before running it try to run it in your head and write down the value of x. Then run it in a javscript engine ;-)

Semantics specifications *should* be written in a formal language like Structural Operational Semantics... but then only a few people can actually read them ;-)

Check SOS description of JS here! (the example was also from there)
http://www.stanford.edu/class/cs242/slides/OperSemanticsJS

But again thanks for this insight, i think it&#039;s one of the bad things of javascript ;-)
Greetings to Nikolai!</description>
		<content:encoded><![CDATA[<p>Ah nice, i knew about function scope but i did not new about the javascript interpreter checking all declaration before execution.  Again it&#8217;s all about semantics, that&#8217;s why a specification is so important. Too bad the ecmascript specifications are written in plain text. This increases the chances of different interpretations and ambiguity.</p>
<p>For example what do you think the value of x is after running this code?</p>
<p>var b=10;<br />
var f=function() {<br />
 var b=5;<br />
 function g() {<br />
  var b=8;<br />
  return this.b;<br />
 }<br />
 return g();<br />
};<br />
var x = f();</p>
<p>Before running it try to run it in your head and write down the value of x. Then run it in a javscript engine ;-)</p>
<p>Semantics specifications *should* be written in a formal language like Structural Operational Semantics&#8230; but then only a few people can actually read them ;-)</p>
<p>Check SOS description of JS here! (the example was also from there)<br />
<a href="http://www.stanford.edu/class/cs242/slides/OperSemanticsJS" rel="nofollow">http://www.stanford.edu/class/cs242/slides/OperSemanticsJS</a></p>
<p>But again thanks for this insight, i think it&#8217;s one of the bad things of javascript ;-)<br />
Greetings to Nikolai!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
