<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Eddie Welker.com &#187; javascript</title>
	<atom:link href="http://www.eddiewelker.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eddiewelker.com</link>
	<description>Advanced web development, with a little bit about me thrown in too.</description>
	<lastBuildDate>Thu, 24 Sep 2009 13:37:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Review of &#8220;Prototype-Based Programming&#8221;</title>
		<link>http://www.eddiewelker.com/2009/01/29/review-of-prototype-based-programming/</link>
		<comments>http://www.eddiewelker.com/2009/01/29/review-of-prototype-based-programming/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 01:14:56 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[prototypal]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.eddiewelker.com/?p=232</guid>
		<description><![CDATA[
I ran across a mention of &#8220;Prototype-Based Programming&#8221; back when I was first learning JavaScript.  I thought it would be an interesting read, but forgot to bookmark it, and forgot to look into it further.  Once I finally remembered it, it proved hard to find (and an expensive gamble from Amazon), until I found it [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-235 alignleft" style="margin-right: 10px; margin-bottom: 10px;" title="Prototype-Based Programming" src="http://www.eddiewelker.com/wp-content/uploads/2009/01/prototypebasedprogramming.png" alt="Prototype-Based Programming" width="225" height="356" /></p>
<p>I ran across a mention of &#8220;Prototype-Based Programming&#8221; back when I was first learning JavaScript.  I thought it would be an interesting read, but forgot to bookmark it, and forgot to look into it further.  Once I finally remembered it, it proved hard to find (and an expensive gamble from Amazon), until I found it through NIH&#8217;s interlibrary loan system.</p>
<p>I was quite excited to get my hands on a copy of this book, I was interested in learning more about the general theory that went into languages with prototypal inheritance.  I thought this would allow me a special insight into JavaScript.  However, as I found reading it&#8230; despite it&#8217;s 1999 publication date, JavaScript wasn&#8217;t even mentioned in the book!  Regardless, I found parts of it to be quite interesting and insightful.</p>
<p>The book is broken up into three sections (as mentioned on the cover), Concepts, Languages, and Applications.  Each section has 4 associated chapters which are really various papers, some of which seem to be difficult to find elsewhere.</p>
<p>The first section, &#8220;Concepts&#8221; was the most interesting. The first was titled &#8220;Classes vs. Prototypes: Some Philosophical and Historical Observations.&#8221;  This chapter provided a nice introduction to the topic, including the history of classification, going back to Aristotle and proceeding to Ludwig Wittgenstein who had an interesting example about classifying the characteristics of an item as simple as a &#8220;game&#8221;.  It goes on to transition to a programming perspective.  A point that is made repeatedly throughout many chapters that the idea of classical inheritance necessitating construction from the top (superclasses) to the bottom (subclasses) is inherently contradictory to the way humans think.  When unfamiliar with a domain, a person can more easily deal with concrete examples, and only discern the abstract general form after discovering these patterns in the concrete cases.  Though unable to put my finger on this idea, I&#8217;ve experienced it a number of times when programming myself, and couldn&#8217;t agree more.</p>
<p>The next chapter, &#8220;Classifying Prototype-based Programming Languages&#8221; sought to categorize the theoritical aspects of different prototypal languages.  This is the chapter where I most missed the reference to JavaScript, but I may look into doing that myself some other day.  &#8220;The Stripetalk Papers: Understandability as a Language Design Issue in Object-Oriented Programming Systems&#8221;, made an argument that prototype based systems could be used to enhance the learnability of languages.  Finally, the chapter &#8220;Classes versus Prototypes in Object-Oriented Languages&#8221; looked at the advantages and disadvantages of class-based and prototype-based languages.  This chapter was quite interesting, however brief.</p>
<p>The second section, &#8220;Languages&#8221;, lacking JavaScript, was less useful than I had hoped.  &#8220;Programming as an Experience: The Inspiration for Self&#8221; was interesting as it described the thought process going into creating the Self language, and expanded some of the ideas presented in the book&#8217;s second chapter.  Alas, I&#8217;ve haven&#8217;t yet gotten around to learning Self, but the ideas and history presented were interesting in the abstract.  &#8220;NewtonScript: Prototypes on the Palm&#8221; was interesting mostly because of it&#8217;s Lisp-like syntax and it&#8217;s description of internal closures, while &#8220;The Prototype-Instance Object Systems in Amulet and Garnet&#8221; took an in-depth look at the implementation of these two languages.  I only skimmed the &#8220;Omega: Statically Typed Prototypes&#8221; chapter, as it was rather brief, and I don&#8217;t feel confident enough (or have any real desire) to enter the static-typed/dynamic-typed languages argument.</p>
<p>The final section, &#8220;Applications&#8221;, was where this book showed it&#8217;s age.  &#8220;Self includes: Smalltalk&#8221; involved translating Smalltalk programs into Self, which is interesting, but I don&#8217;t see much practical application for this today (maybe if you&#8217;re translating Ruby to JavaScript? Not sure).  &#8220;Using Prototypes for Program Restructuring&#8221; demonstrated the use of an algorithm that would help to restructure code into a slot-based prototype system in a application called Guru.  &#8220;Prototype-Based Programming for Abstract Program Visualisation&#8221; ended up being skimmed, because while the topic matter seemed interesting, the demonstrations from the black-and-white mac era looked totally antiquated, and I am sure that they have been written many times in other languages since the writing.  Finally, &#8220;Agora: The Scheme of Object-Orientation, or, the Simplest MOP in the World&#8221; detailed the Agora language, a pure OO language which relied only on objects and message passing, while being implemented as a reflective language inspired by Scheme, of all things. Weird, but interesting.</p>
<p>You know as well as I do that computer technology is a moving target, and something published in 1999 will be outdated to a certain degree.  The good part of this book is that the abstract notions in it are rather timeless, as they have been built on over time.  Parts of this book may be out of date, but parts aren&#8217;t, and regardless, it&#8217;s an interesting read.  I recommend it, if you&#8217;re even slightly interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2009/01/29/review-of-prototype-based-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review of &#8220;Object-Oriented JavaScript&#8221;</title>
		<link>http://www.eddiewelker.com/2008/10/25/object-oriented-javascript-review/</link>
		<comments>http://www.eddiewelker.com/2008/10/25/object-oriented-javascript-review/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 02:02:16 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://www.eddiewelker.com/?p=122</guid>
		<description><![CDATA[I recently read Object Oriented JavaScript, by Stoyan Stefanov. In reviewing it, I found it was one of the most interesting books I've read in a while, for some good reasons and a few more curious reasons.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/object-oriented-javascript-applications-libraries/book"><img class="size-full wp-image-125 alignleft" style="margin-right: 10px; margin-bottom: 10px;" title="Object Oriented JavaScript" src="http://www.eddiewelker.com/wp-content/uploads/2008/10/objectorientedjavascript.jpg" alt="Object Oriented JavaScript" width="225" height="286" /></a></p>
<p>I recently read <a href="http://www.packtpub.com/object-oriented-javascript-applications-libraries/book">Object-Oriented JavaScript</a>, by <a href="http://www.phpied.com/">Stoyan Stefanov</a>.  In reviewing it, I found it was one of the most interesting books I&#8217;ve read in a while, for some good reasons and a few more curious reasons.</p>
<p>Object-Oriented JavaScript was authored by Mr. Stefanov, who is a developer at Yahoo.  It features an impressive number of reviewers (twelve), among them <a href="http://www.crockford.com/">Douglas Crockford</a>, the author of <a href="http://oreilly.com/catalog/9780596517748/"><em>JavaScript: The Good Parts</em></a>, and <a href="http://techfoolery.com/">Ross Harmes</a>, author of <a href="http://www.apress.com/book/view/159059908x"><em>JavaScript Design Patterns</em></a>, both of whom are Stefanov&#8217;s Yahoo co-workers.  In a reasonable 330 pages, it features eight chapters on JavaScript&#8217;s History, Basic Syntax/Features, Functions, Objects, Prototypes, Inheritance, the DOM, and Patterns/Best Practices.</p>
<p>Readers with little to no JavaScript knowledge will be able to read this book, but I&#8217;m uncertain how much they&#8217;ll be able to glean from the meaty inner chapters (functions, objects, prototypes, and inheritance).  Readers with moderate JavaScript understanding should be able to learn a great deal from this book.  At the very least, advanced readers should be reminded of some of the language&#8217;s quirkier parts, as well as benefiting from an organized chapter on inheritance techniques.</p>
<p>It is tricky placing Object-Oriented JavaScript in context of the corpus of JavaScript literature.  This book includes more than a little introductory material (chapters 1-2), while the core chapters (3-6) are way beyond an introduction.  Only after those chapters (which I will discuss in a second) is the reader introduced briefly to the DOM and XHR before a chapter on design patterns and best practices.  At a minimum, every chapter is useful and full of hints that are difficult to <em>grep</em> from run-of-the-mill JavaScript books. The book steers clear of the murky world of browser differences unless they&#8217;re pertinent to the topic of Object-Oriented JavaScript, which seems perfectly acceptable.</p>
<p>Back to those middle chapters, they are sheer gold.  I am going force myself to make time to re-read this book, if not those chapters alone.  They present, in a clear and organized fashion, many difficult aspects of the language, including closures, prototype, and 12 different methods for inheritance.  In comparison, I believe Harmes&#8217; book isn&#8217;t as well organized, and Crockford&#8217;s book isn&#8217;t as clear. Stefanov doesn&#8217;t break much new ground here, but the clarity describing these techniques is quite valuable regardless.</p>
<p>Object-Oriented JavaScript appears occasionally try to be something to everyone.  This is kind of disappointing, since I would have <span style="text-decoration: underline;">loved</span> to have seen any additional discussion or insight the author could have offered in the core chapters.  There are tons of introductory JavaScript books, so I don&#8217;t know what a book titled Object-Oriented JavaScript gains by including more introduction. This shouldn&#8217;t detract from the book&#8217;s overall value.  All of the chapters are well written and useful.  However as a reader gains a better understanding of JavaScript, the introductory chapters will become far less useful, while the other chapters will remain an excellent reference.</p>
<p>In my mind, the three best JavaScript books are Flanagan&#8217;s <em>JavaScript The Definitive Guide</em>, Crockford&#8217;s <em>JavaScript: The Good Parts</em>, and Harmes&#8217; and [Dustin] Diaz&#8217;s <em>Pro JavaScript Design Patterns</em>.  Object-Oriented JavaScript doesn&#8217;t belong in that company for the reasons mentioned above.  However, I would easily give it fourth place, and recommend it as a clear description of JavaScript&#8217;s harder parts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2008/10/25/object-oriented-javascript-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting a button element&#8217;s value attribute (not innerHTML) in IE</title>
		<link>http://www.eddiewelker.com/2008/05/23/getting-a-button-elements-value-attribute-not-innerhtml-in-ie/</link>
		<comments>http://www.eddiewelker.com/2008/05/23/getting-a-button-elements-value-attribute-not-innerhtml-in-ie/#comments</comments>
		<pubDate>Fri, 23 May 2008 05:52:25 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[ie]]></category>
		<category><![CDATA[ie8]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[attributes array]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[value]]></category>

		<guid isPermaLink="false">http://edwardwelker.com/2008/05/23/getting-a-button-elements-value-attribute-not-innerhtml-in-ie/</guid>
		<description><![CDATA[After spending a small part of my evening debugging Javascript in IE (which is ALWAYS a pleasure), I found out one of my errors was a mistake I had made before&#8230; trying to access button.value in IE.  IE, of course, being IE, returns the innerHTML value of the button, instead of the value attribute.  Last [...]]]></description>
			<content:encoded><![CDATA[<p>After spending a small part of my evening debugging Javascript in IE (which is ALWAYS a pleasure), I found out one of my errors was a mistake I had made before&#8230; trying to access button.value in IE.  IE, of course, being IE, returns the innerHTML value of the button, instead of the value attribute.  Last time I ran into this, I used a class instead of value, and moved on with my life.  Tonight, I was feeling stubborn, and I found a better way&#8230;</p>
<p>target.value = target.getAttributeNode(&#8216;value&#8217;).nodeValue;</p>
<p>I&#8217;m sure I&#8217;m about the millionth person to discover this, but I couldn&#8217;t find it anywhere using standard searches, so I thought I&#8217;d try to emphasize it here so others could find it. (Hopefully it&#8217;s not so common that <em>everyone else</em> knows it!)</p>
<p>At first, I used the following:</p>
<p>target.value =  target.attributes.getNamedItem(&#8216;value&#8217;).nodeValue;</p>
<p>Then I looked at <a href="http://www.davidflanagan.com/">Flanagan&#8217;s</a> <a href="http://www.amazon.com/gp/product/0596101996?ie=UTF8&amp;tag=davidflanagancom&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=0596101996"><em>Javascript: The Definitive Guide</em></a> (using his amazon associates link),  where he states that IE implementation of the attributes array,&#8221;makes it impossible to use this feature portably.&#8221;  He doesn&#8217;t mention which version of IE (this specific line of code worked in IE6, IE7, and IE8a), but I figured I&#8217;d go with the more general version.</p>
<p>If you read this, I hope I could save you a bit of time.</p>
<p>P.S. &#8211; I used IE8a&#8217;s Debugger to help.  Here&#8217;s hoping they develop it further before the standard release.  It&#8217;s MUCH better than flying blind, but I can&#8217;t imagine a less helpful message than specifying an object in the console, and seeing &#8220;{&#8230;}&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2008/05/23/getting-a-button-elements-value-attribute-not-innerhtml-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is what I have been reduced to</title>
		<link>http://www.eddiewelker.com/2008/05/12/this-is-what-i-have-been-reduced-to/</link>
		<comments>http://www.eddiewelker.com/2008/05/12/this-is-what-i-have-been-reduced-to/#comments</comments>
		<pubDate>Tue, 13 May 2008 04:57:26 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://edwardwelker.com/2008/05/12/this-is-what-i-have-been-reduced-to/</guid>
		<description><![CDATA[I found it very amusing that I wrote a javascript for loop
for( int j=0; j&#60;checked.length; j++)
Ahh, C comes back to you at the oddest times.
]]></description>
			<content:encoded><![CDATA[<p>I found it very amusing that I wrote a javascript for loop</p>
<p>for( int j=0; j&lt;checked.length; j++)</p>
<p>Ahh, C comes back to you at the oddest times.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2008/05/12/this-is-what-i-have-been-reduced-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big release day on the webbernet</title>
		<link>http://www.eddiewelker.com/2008/03/05/big-release-day-on-the-webbernet/</link>
		<comments>http://www.eddiewelker.com/2008/03/05/big-release-day-on-the-webbernet/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 04:06:37 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[firefox]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[ie8]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[standards]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[acid2]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[contacts]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fire eagle]]></category>
		<category><![CDATA[geo tagging]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[openAIM]]></category>
		<category><![CDATA[operator plugin]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[whitepapers]]></category>
		<category><![CDATA[wia aria]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://edwardwelker.com/2008/03/05/big-release-day-on-the-webbernet/</guid>
		<description><![CDATA[So I guess it&#8217;s simply the time of year.  Many big releases today&#8230; software, APIs, and more!
First, the biggest.  IE8 has been released in initial beta.  The release was also included a general overview of IE8&#8217;s new features and fixes.  It&#8217;s actually quite a lot of information to absorb all at [...]]]></description>
			<content:encoded><![CDATA[<p>So I guess it&#8217;s simply the time of year.  Many big releases today&#8230; software, APIs, and more!</p>
<p>First, the biggest.  <a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/default.htm" title="Microsoft releases Internet Explorer 8 Beta">IE8 has been released</a> in initial beta.  The release was also included a general overview of IE8&#8217;s new features and fixes.  It&#8217;s actually quite a lot of information to absorb all at once.  I&#8217;ve skimmed a number of <a href="http://code.msdn.microsoft.com/ie8whitepapers" title="Whitepapers for Microsoft Internet Explorer 8">the IE8 whitepapers</a>, and feel the biggest changes are W3C&#8217;s <a href="http://www.w3.org/TR/wai-aria/" title="Web Accessibility Initiative-Accessible Rich Internet Applications">WIA-ARIA</a> support, <a href="http://" title="Acid 2">Acid2</a> compliance, the <a href="http://go.microsoft.com/fwlink?LinkID=110273" title="selectors api">javascript selectors api</a>, and their assertion of achieving <a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=ie8whitepapers&amp;DownloadId=1025" title="css 2.1 compliance">CSS 2.1 compliance</a>.  Of course, the devil is in the details, and there is no company for which that statement is more true.  They have a lot of work ahead, and we know they talk a good game.  The big upside, however, is that they are actually talking about it.  Out in the open.  Big step, and I applaud them for that.</p>
<p>The other biggest buzz of the day was from Yahoo, in announcing the <a href="http://fireeagle.yahoo.net/" title="Yahoo Fire Eagle Website">beta of their Fire Eagle service</a>, an API for broadcasting your physical location to the web.  I wouldn&#8217;t call it earth-shattering, but I think that there&#8217;s a good chance a number of cool things are built with it.  <a href="http://developer.yahoo.net/blogs/theater/archives/2008/03/fire_eagle_launches.html" title="Yahoo's Fire Eagle API introduced">Watch the video of it&#8217;s introduction</a>, and then <a href="http://blog.programmableweb.com/2008/03/05/yahoo-launches-fire-eagle/" title="Yahoo Fire Eagle Quick Overview">take a look here</a> to quickly get an idea of the details.  It would appear from the details that it was written in a highly usable way.</p>
<p>Of more direct importance to me, <a href="http://googledataapis.blogspot.com/2008/03/3-2-1-contact-api-has-landed.html" title="Google introduces Contacts API for accessing Gmail contacts securely">Google has announced their Contacts API</a>. I despise when sites ask me to enter my username/password for <em>other sites</em>.  The most offensive request is for Gmail.  I don&#8217;t have any interesting emails, let me tell you&#8230; but I certainly don&#8217;t want to let others read them.  The Contacts API is a safe way for distribution and use of your Gmail contacts, without threatening the security of your Gmail account or your other Google-stored information.  With this, I should be able to sync my Gmail contacts with my desktop mail contacts.  I&#8217;m very happy about that.</p>
<p>Heading up the long-since-overdue category, <a href="http://dev.aol.com/aim" title="AOL opens Instant Messenger Protocol, OpenAIM">AOL has announced they&#8217;ve opened their Instant Messenger Protocol, OpenAIM</a>.  <strong>Finally</strong>.  I remember ages ago when&#8230; well, it&#8217;s all in the past now.  That&#8217;s one big wall that has been broken down between protocols, and hopefully Yahoo and Microsoft will fall in line.  It will be great if other apps can finally use the features that have been limited to the AIM client for all this time.  I use <a href="http://www.adiumx.com/" title="Adium; A Mac Instant Messenging Client">Adium</a> and <a href="http://www.pidgin.im/" title="Pidgin; Open Source Messenging Client">Pidgin</a> most of the time (Adium, I believe uses Pidgin&#8217;s core), and look forward to seeing what they do with the new open protocol.   (On a personal note, hopefully this doesn&#8217;t spell any negative news for my friends who work on AIM.)</p>
<p>And to round things off, here&#8217;s two smaller releases today (one based on IE8&#8217;s Activities):</p>
<ul>
<li>The <a href="https://addons.mozilla.org/en-US/firefox/addon/4106" title="Operator Plugin for Mozilla Firefox">Firefox Operator plugin</a> (for <a href="http://www.microformats.org" title="Microformats website">Microformats</a>) has already <a href="http://www.kaply.com/weblog/2008/03/05/microsoft-activities-for-firefox/" title="Operator Plugin initial release implementing Activities">given a go at implementing Activities</a>, which were announced at today&#8217;s IE8 overview.</li>
<li><a href="http://open.blogs.nytimes.com/2008/03/05/the-new-york-times-perl-profiler/" title="New York Times contributes profiling perl module to CPAN">The New York Times has contributed a perl module to CPAN</a>.  Looks like a useful profiling tool, especially since it profiles line-by-line.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2008/03/05/big-release-day-on-the-webbernet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing Scheme in Javascript I</title>
		<link>http://www.eddiewelker.com/2008/02/10/writing-scheme-in-javascript-i/</link>
		<comments>http://www.eddiewelker.com/2008/02/10/writing-scheme-in-javascript-i/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 18:04:16 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[global scope]]></category>
		<category><![CDATA[kent dybvig]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[scheme programming language]]></category>
		<category><![CDATA[the scheme programming language]]></category>

		<guid isPermaLink="false">http://edwardwelker.com/2008/02/10/writing-scheme-in-javascript-i/</guid>
		<description><![CDATA[This is an interesting little function that I ran across in Kent Dybvig&#8217;s The Scheme Programming Language.  I thought I would give it a go in javascript.  I wrote it out, and ran into two problems.  First, I wasn&#8217;t returning anything from the anonymous-self-executing function, so it was being garbage collected, and [...]]]></description>
			<content:encoded><![CDATA[<p>This is an interesting little function that I ran across in Kent Dybvig&#8217;s <em><a href="http://www.scheme.com/tspl3/start.html#./start:h9">The Scheme Programming Language</a>.</em>  I thought I would give it a go in javascript.  I wrote it out, and ran into two problems.  First, I wasn&#8217;t returning anything from the anonymous-self-executing function, so it was being garbage collected, and the call to tell() would give an undefined (secret didn&#8217;t exist anymore).  The second was that I initially declared secret without the <em>var</em> which gave it global scope.  Took me a little while to figure these out, but since I haven&#8217;t looked at any javascript in months, I don&#8217;t feel so bad.<br />
<code>
<pre>

/* the original function from The Scheme Programming Language
(define shhh #f)
(define tell #f)

(let ((secret 0))
  (set! shhh
    (lambda (message)
      (set! secret message)))
  (set! tell
    (lambda ()
      secret)))</code></pre>
<pre><code>
(shhh "sally likes harry")
(tell) <graphic> "sally likes harry"
secret <graphic> Error: variable secret is not bound
*/
</graphic></graphic></code></pre>
<pre><code><graphic><graphic>//the Javascript version of the same function
</graphic></graphic></code></pre>
<pre><code><graphic><graphic>var shhh = false;
var tell = (function(){
 var secret = 0;
 shhh = function(message) { secret = message; }
 return function() { console.info(secret); }
})();

shhh("harry likes sally");
console.info("tell: " + tell() );</graphic></graphic></pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2008/02/10/writing-scheme-in-javascript-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extreme early review of Advanced DOM Scripting</title>
		<link>http://www.eddiewelker.com/2007/08/22/extreme-early-review-of-advanced-dom-scripting/</link>
		<comments>http://www.eddiewelker.com/2007/08/22/extreme-early-review-of-advanced-dom-scripting/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 04:03:22 +0000</pubDate>
		<dc:creator>Eddie</dc:creator>
				<category><![CDATA[books]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[closures]]></category>

		<guid isPermaLink="false">http://edwardwelker.com/blog/?p=13</guid>
		<description><![CDATA[Started reading through Advanced DOM Scripting by Jeffrey Sambells.  Normally would wait to comment until I got to the end, but I am excited that he mentioned both the scope chain and closures in the first chapter!   As my sister would say, &#8220;Sweet Lovin!&#8221;
]]></description>
			<content:encoded><![CDATA[<p>Started reading through <a href="http://advanceddomscripting.com/2007/07/19/the-smell-of-fresh-ink/trackback/">Advanced DOM Scripting</a> by Jeffrey Sambells.  Normally would wait to comment until I got to the end, but I am excited that he mentioned both the scope chain and closures in the first chapter!   As my sister would say, &#8220;Sweet Lovin!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eddiewelker.com/2007/08/22/extreme-early-review-of-advanced-dom-scripting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
