<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: with Statement Considered Harmful</title>
	<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/</link>
	<description>News and Artilces about Designing and Developing with Yahoo! Libraries.</description>
	<pubDate>Mon, 12 May 2008 09:48:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Kevin Greer</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-364807</link>
		<dc:creator>Kevin Greer</dc:creator>
		<pubDate>Thu, 01 May 2008 17:24:13 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-364807</guid>
		<description>This also works:

&lt;code&gt;
with ({o:ooo.eee.oo.ah_ah.ting.tang.walla.walla})
{
  o.bing = true;
  o.bang = true;
}
&lt;/code&gt;
but reads a little nicer and limits the scope of 'o'.</description>
		<content:encoded><![CDATA[<p>This also works:</p>
<p><code><br />
with ({o:ooo.eee.oo.ah_ah.ting.tang.walla.walla})<br />
{<br />
  o.bing = true;<br />
  o.bang = true;<br />
}<br />
</code><br />
but reads a little nicer and limits the scope of &#8216;o&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Helping the YUI Compressor &#187; Yahoo! User Interface Blog</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-302591</link>
		<dc:creator>Helping the YUI Compressor &#187; Yahoo! User Interface Blog</dc:creator>
		<pubDate>Mon, 11 Feb 2008 14:01:42 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-302591</guid>
		<description>[...] with statement is another that is often recommended to avoid in JavaScript. For YUI Compressor, the reason is the same for eval(): just the presence of with in a function [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] with statement is another that is often recommended to avoid in JavaScript. For YUI Compressor, the reason is the same for eval(): just the presence of with in a function [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: O &#8220;with&#8221; em linguagens de programação &#171; blog</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-159545</link>
		<dc:creator>O &#8220;with&#8221; em linguagens de programação &#171; blog</dc:creator>
		<pubDate>Sat, 21 Jul 2007 02:36:10 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-159545</guid>
		<description>[...] C++, porém o estilo Pascal não é recomendado, por causa da natureza dinâmica da linguagem (with-statement-considered-harmful). Como propriedades podem ser adicionadas livremente aos objetos e variáveis globais podem ser [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] C++, porém o estilo Pascal não é recomendado, por causa da natureza dinâmica da linguagem (with-statement-considered-harmful). Como propriedades podem ser adicionadas livremente aos objetos e variáveis globais podem ser [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: .wpal &#187; Blog Archives &#187; зло with</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-151412</link>
		<dc:creator>.wpal &#187; Blog Archives &#187; зло with</dc:creator>
		<pubDate>Tue, 03 Jul 2007 13:47:15 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-151412</guid>
		<description>[...] бы всё хорошо и удобно. Но вот мне на глаза попалась статья на YUI-блоге, которую и попробую [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] бы всё хорошо и удобно. Но вот мне на глаза попалась статья на YUI-блоге, которую и попробую [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Holmes</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-144116</link>
		<dc:creator>David Holmes</dc:creator>
		<pubDate>Thu, 21 Jun 2007 08:49:33 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-144116</guid>
		<description>Responding to myself, to save anyone else the trouble :

I have come to the realization that the above pattern is indeed very common. One can encounter it in the YUI code for example, and I have seen it called a "Crockford Module pattern".

So, tricky, but very useful !</description>
		<content:encoded><![CDATA[<p>Responding to myself, to save anyone else the trouble :</p>
<p>I have come to the realization that the above pattern is indeed very common. One can encounter it in the YUI code for example, and I have seen it called a &#8220;Crockford Module pattern&#8221;.</p>
<p>So, tricky, but very useful !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Holmes</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-137198</link>
		<dc:creator>David Holmes</dc:creator>
		<pubDate>Thu, 07 Jun 2007 20:38:33 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-137198</guid>
		<description>Mr. Crockford, you propose a new snippet in your last comment, which is equivalent to :

(function () {
    var o = ...
    o.foo  = ...
    o.bar = ...
})();

Thank you for posting it, I was missing the parens around the function statement when I came up with it, and without them the snippet does not work. (I wonder why, actually ?)

However you call that snippet "tricky". Did you mean to be disparaging, or was it irony ? Because it seems to me that it is the ideal way of implementing your suggestion from the article without polluting the global namespace with the temporary shortcut variables.</description>
		<content:encoded><![CDATA[<p>Mr. Crockford, you propose a new snippet in your last comment, which is equivalent to :</p>
<p>(function () {<br />
    var o = &#8230;<br />
    o.foo  = &#8230;<br />
    o.bar = &#8230;<br />
})();</p>
<p>Thank you for posting it, I was missing the parens around the function statement when I came up with it, and without them the snippet does not work. (I wonder why, actually ?)</p>
<p>However you call that snippet &#8220;tricky&#8221;. Did you mean to be disparaging, or was it irony ? Because it seems to me that it is the ideal way of implementing your suggestion from the article without polluting the global namespace with the temporary shortcut variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth Flowers</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-125883</link>
		<dc:creator>Seth Flowers</dc:creator>
		<pubDate>Thu, 24 May 2007 14:49:28 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-125883</guid>
		<description>Douglas, explain the advantage of using your suggestion of:

(function (Dom, Event) {

// my program here…

}) (YAHOO.util.Dom, YAHOO.util.Event);

over Isaac's suggestion of:

with ({
Dom:YAHOO.util.Dom,
Event:YAHOO.util.Event
}) {

// my program here…

}

They appear functionally and semantically equivalent.</description>
		<content:encoded><![CDATA[<p>Douglas, explain the advantage of using your suggestion of:</p>
<p>(function (Dom, Event) {</p>
<p>// my program here…</p>
<p>}) (YAHOO.util.Dom, YAHOO.util.Event);</p>
<p>over Isaac&#8217;s suggestion of:</p>
<p>with ({<br />
Dom:YAHOO.util.Dom,<br />
Event:YAHOO.util.Event<br />
}) {</p>
<p>// my program here…</p>
<p>}</p>
<p>They appear functionally and semantically equivalent.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: I&#8217;d Rather switch Than Fight! &#187; Yahoo! User Interface Blog</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-114652</link>
		<dc:creator>I&#8217;d Rather switch Than Fight! &#187; Yahoo! User Interface Blog</dc:creator>
		<pubDate>Tue, 15 May 2007 05:02:57 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-114652</guid>
		<description>[...] they encourage weak coding patterns. JavaScript has more than its share of attractive nuisances (with, implied globals, new, and semicolon insertion, to name a few). Your programs will be stronger if [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] they encourage weak coding patterns. JavaScript has more than its share of attractive nuisances (with, implied globals, new, and semicolon insertion, to name a few). Your programs will be stronger if [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas Crockford</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-31477</link>
		<dc:creator>Douglas Crockford</dc:creator>
		<pubDate>Sat, 13 Jan 2007 00:28:21 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-31477</guid>
		<description>You don't need with there, either. It is better to use vars in a function. If you want something trickier just to be tricker, try this:

    (function (Dom, Event) {

        // my program here...

    }) (YAHOO.util.Dom, YAHOO.util.Event);</description>
		<content:encoded><![CDATA[<p>You don&#8217;t need with there, either. It is better to use vars in a function. If you want something trickier just to be tricker, try this:</p>
<p>    (function (Dom, Event) {</p>
<p>        // my program here&#8230;</p>
<p>    }) (YAHOO.util.Dom, YAHOO.util.Event);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schlueterica &#187; Lessons in Javascript Optimization</title>
		<link>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-31443</link>
		<dc:creator>Schlueterica &#187; Lessons in Javascript Optimization</dc:creator>
		<pubDate>Fri, 12 Jan 2007 22:25:42 +0000</pubDate>
		<guid>http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/#comment-31443</guid>
		<description>[...] Normally, the with statement is a pretty bad idea. However, when used with an object literal, it can be a very handy way to create private variables. This: [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Normally, the with statement is a pretty bad idea. However, when used with an object literal, it can be a very handy way to create private variables. This: [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.927 seconds -->
