<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Webgyani &#187; JavaScript</title>
	<atom:link href="http://webgyani.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://webgyani.com</link>
	<description>A cognitive perspective on web</description>
	<lastBuildDate>Mon, 31 May 2010 16:25:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>JavaScript Execution Context</title>
		<link>http://webgyani.com/2010/04/javascript-execution-context/</link>
		<comments>http://webgyani.com/2010/04/javascript-execution-context/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 05:47:55 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://webgyani.com/2010/04/javascript-execution-context/</guid>
		<description><![CDATA[I was long wanting to write about JavaScript execution context and how does it work, so here’s my take on what it is, if you find something incorrect or missing please feel free to correct me. ECMAScript has an abstract concept called “execution context”, which means when control is transferred to the ECMAScript executable code, the control is then entered in a execution context. So, what does the above statement mean? Well, it means every time a piece of code is executed in ECMAScript it has an execution context and the currently executing code is associated with that context. This can be conceived as some sort of container which encapsulates the context of the executing code, the could will look for its execution context for identifier and scope resolution. The execution context is not accessible to code; it is purely an implementation mechanism. Active execution contexts form a “stack”, the [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p>I was long wanting to write about JavaScript <em>execution context </em>and how does it work, so here’s my take on what it is, if you find something incorrect or missing please feel free to correct me.</p>
<p>ECMAScript has an abstract concept called “<em>execution context</em>”, which means when control is transferred to the ECMAScript executable code, the control is then entered in a <em>execution context</em>.</p>
<p><strong>So, what does the above statement mean?</strong> Well, it means every time a piece of code is executed in ECMAScript it has an execution context and the currently executing code is associated with that context. This can be conceived as some sort of container which encapsulates the context of the executing code, the could will look for its execution context for identifier and scope resolution. The execution context is not accessible to code; it is purely an implementation mechanism.</p>
<p>Active execution contexts form a “stack”, the bottom element of that “stack” is always the Global Context, where as the topmost element is the active or current execution context; whenever the control is transferred from the currently running executable code to a different piece of code which is not associated with the current execution context, a new  execution context is created and pushed onto the stack. The process of creating and removing execution contexts from the stack is a continuous thing.</p>
<p><strong>Why execution context is so important?</strong> It is because execution context maintains the state  and execution progress of the code. It also determines what should be the value of the ‘<em>this’</em> keyword associated with that execution context. The <em>identifier resolution</em> is also an important part of the execution context, because it is the mechanism which specifies how the binding of an identifier will be resolved in the current/active execution context. To put simply, identifier resolution is a process which determines how the JavaScript engine will retrieve the value of a particular variable and where it will look for.</p>
<p>The execution context is associated with the type of executable code. In JavaScript there are three types of executable code:</p>
<ol>
<li><em>Global Code </em>is the source code which is executed as ECMAScript program, for example – external JS file, inline script block in HTML pages are executed in the Global Context. So, when a <em>global code</em> is executed a <em>global execution context</em> is created and pushed onto the context stack.</li>
<li><em>Function Code</em> is the source code which is parsed as the <em>FunctionBody. </em>The function code does not include body text of the nested functions. Invoking a function creates a new <em>execution context</em> every time, even in the case of recursive execution, and when the function returns, the corresponding execution context is popped up from the execution context stack.</li>
<li>Eval Code is the code that is the source text supplied to the <em>built-in eval</em> function. <em>Eval code</em> has a concept of <em>calling context</em>, which means the execution context from which the <em>eval</em> function has been called.</li>
</ol>
<p><strong>What happens when an execution context is created?</strong> A number of things happen when an execution context is created, if the type of code being executed is a <em>function code</em> then an “Activation Object” is created. Activation Object is a normal object without any prototype, which contains named properties. It stores information regarding variables and call arguments so that those are accessible to the execution context.</p>
<p>There’s more to execution contexts like <em>scope chain</em>, <em>variable object</em> and <em>variable initialization</em>. All of these I’ll cover in later posts. I assume the above explanation will serve as a primer on how the JavaScript engine works internally. Please do share your thoughts on this.</p>
<p>
<strong>Update:</strong> For more detailed information on Execution Contexts check out this in-depth article written by Dmitry A. Soshnikov <a href="http://dmitrysoshnikov.com/ecmascript/chapter-1-execution-contexts/">JavaScript Execution Contexts</a>, do not forget to go through other articles written by him, those are an excellent source of information on JavaScript/Ecmascript internals.</p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2010/04/javascript-execution-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>John Resig &#8211; ECMAScript 5 Objects and Properties</title>
		<link>http://webgyani.com/2009/05/john-resig-ecmascript-5-objects-and-properties/</link>
		<comments>http://webgyani.com/2009/05/john-resig-ecmascript-5-objects-and-properties/#comments</comments>
		<pubDate>Thu, 21 May 2009 07:19:22 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ECMAScript 5]]></category>

		<guid isPermaLink="false">http://webgyani.wordpress.com/?p=46</guid>
		<description><![CDATA[ECMAScript 5 is on its way. Rising from the ashes of ECMAScript 4, which got scaled way back and became ECMAScript 3.1, which was then re-named ECMAScript 5 http://ejohn.org/blog/ecmascript-5-objects-and-properties/ ECMAScript is finally there, read the whole post by John Resig (Creator of  jQuery), and see the changes it brings to the JavaScript development, and the good news is that all major browser vendors agreed to implement this sooner than later. It has a detail description of how we will be accessing objects and it&#8217;s properties with some simple example code, to me this has opened a completely new era for JavaScript programming, though this specification brings real power to JavaScript which also comes with the cost of increased complexity, but as you know in any powerful language complexity is always there, it&#8217;s up to the developer how he/she can reduce the complexity but uses the full power of the language. [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<blockquote><p>ECMAScript 5 is on its way. Rising from the ashes of ECMAScript 4, which got scaled way back and became ECMAScript 3.1, which was then re-named ECMAScript 5</p></blockquote>
<p><a title="ECMAScript 5 Objects and Properties" href="http://ejohn.org/blog/ecmascript-5-objects-and-properties/" target="_self">http://ejohn.org/blog/ecmascript-5-objects-and-properties/</a></p>
<p>ECMAScript is finally there, read the whole post by John Resig (Creator of  jQuery), and see the changes it brings to the JavaScript development, and the good news is that all major browser vendors agreed to implement this sooner than later. It has a detail description of how we will be accessing objects and it&#8217;s properties with some simple example code, to me this has opened a completely new era for JavaScript programming, though this specification brings real power to JavaScript which also comes with the cost of increased complexity, but as you know in any powerful language complexity is always there, it&#8217;s up to the developer how he/she can reduce the complexity but uses the full power of the language. Lastly, I just can&#8217;t wait to get my hands dirty with ECMAScript 5 <img src='http://webgyani.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2009/05/john-resig-ecmascript-5-objects-and-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Better JavaScript Profiler with WebKit</title>
		<link>http://webgyani.com/2009/04/building-a-better-javascript-profiler-with-webkit-%c2%ab-alert-debugging/</link>
		<comments>http://webgyani.com/2009/04/building-a-better-javascript-profiler-with-webkit-%c2%ab-alert-debugging/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 03:31:11 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://webgyani.wordpress.com/?p=39</guid>
		<description><![CDATA[Francisco Tolmasky has implemented cool hack/patch to webkit to solve the JavaScript Profilers displying &#8220;?&#8221; as the name of any anonymous functions, follow the link at the bottom of the post for the full story&#8230; Here is the little excerpt from that article: I had the pleasure of showing off some the cool new features we’ve been adding to the WebKit inspector at JSConf last week. It’s no secret that debugging basically sucks in JavaScript, and until recently, it was a little bit worse in Objective-J. Up until now we’ve focused mainly on adding stop gap measures to our own code, but recently we’ve decided to shift gears and attack the problem head on in the browsers themselves. This is why these past couple of weeks I’ve set aside the JavaScript code and instead focused on working with the great guys on the WebKit team on providing a solid debugging [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p>Francisco Tolmasky has implemented cool hack/patch to webkit to solve the JavaScript Profilers displying &#8220;?&#8221; as the name of any anonymous functions, follow the link at the bottom of the post for the full story&#8230;</p>
<p>Here is the little excerpt from that article:</p>
<blockquote><p>I had the pleasure of showing off some the cool new features we’ve been adding to the WebKit inspector at JSConf last week. It’s no secret that debugging basically sucks in JavaScript, and until recently, it was a little bit worse in Objective-J. Up until now we’ve focused mainly on adding stop gap measures to our own code, but recently we’ve decided to shift gears and attack the problem head on in the browsers themselves. This is why these past couple of weeks I’ve set aside the JavaScript code and instead focused on working with the great guys on the WebKit team on providing a solid debugging experience both in Objective-J and JavaScript in general. We first decided to focus on profiling, since this is an area of considerable interest for a framework&#8230;</p></blockquote>
<p><a href="http://www.alertdebugging.com/2009/04/29/building-a-better-javascript-profiler-with-webkit/" target="_self">Read the detailed article here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2009/04/building-a-better-javascript-profiler-with-webkit-%c2%ab-alert-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
