<?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: On Language Design: Magic Variables in Compojure</title>
	<atom:link href="http://zef.me/2650/on-language-design-magic-variables-in-compojure/feed" rel="self" type="application/rss+xml" />
	<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure</link>
	<description>Technology, Me, You.</description>
	<lastBuildDate>Thu, 09 Sep 2010 19:08:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Zef Hemel</title>
		<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure/comment-page-1#comment-3598</link>
		<dc:creator>Zef Hemel</dc:creator>
		<pubDate>Fri, 08 Jan 2010 15:35:46 +0000</pubDate>
		<guid isPermaLink="false">http://zef.me/?p=2650#comment-3598</guid>
		<description>&lt;p&gt;That looks a lot nicer, however the :params there should actually be just params, am I right?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>That looks a lot nicer, however the :params there should actually be just params, am I right?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Zef Hemel</title>
		<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure/comment-page-1#comment-3597</link>
		<dc:creator>Zef Hemel</dc:creator>
		<pubDate>Fri, 08 Jan 2010 14:43:41 +0000</pubDate>
		<guid isPermaLink="false">http://zef.me/?p=2650#comment-3597</guid>
		<description>&lt;p&gt;Yes, I am aware of this, but think it&#039;s a trade off. Either keep passing loads of values around to functions (because at some point, some function may need that value), or solve it with dynamically bound variables. Neither is perfect.&lt;br&gt;&lt;br&gt;I agree that limiting the availability of the &lt;code&gt;request&lt;/code&gt; value within the handler can be good, but it should not appear out of nowhere, it should be declared as part of the syntax, like weavejester is proposing now.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Yes, I am aware of this, but think it&#39;s a trade off. Either keep passing loads of values around to functions (because at some point, some function may need that value), or solve it with dynamically bound variables. Neither is perfect.<br /><br />I agree that limiting the availability of the <code>request</code> value within the handler can be good, but it should not appear out of nowhere, it should be declared as part of the syntax, like weavejester is proposing now.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: kotarak</title>
		<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure/comment-page-1#comment-3592</link>
		<dc:creator>kotarak</dc:creator>
		<pubDate>Fri, 08 Jan 2010 11:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://zef.me/?p=2650#comment-3592</guid>
		<description>&lt;p&gt;OT: You can use &nbsp; to indent code. bleh.... Disqus should do something about that...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OT: You can use &amp;nbsp; to indent code. bleh&#8230;. Disqus should do something about that&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: weavejester</title>
		<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure/comment-page-1#comment-3591</link>
		<dc:creator>weavejester</dc:creator>
		<pubDate>Fri, 08 Jan 2010 00:04:38 +0000</pubDate>
		<guid isPermaLink="false">http://zef.me/?p=2650#comment-3591</guid>
		<description>&lt;p&gt;The &quot;magic&quot; local bindings in Compojure are also a feature I don&#039;t particularly like; and I wrote that piece of code. It was the least worst solution I could think of at the time.&lt;br&gt;&lt;br&gt;The reason I used local bindings, rather than thread-local vars, is because I didn&#039;t want the request map to be passed implicitly to the controller functions, like so:&lt;br&gt;&lt;br&gt;    (defn do-something []&lt;br&gt;      (str &quot;Hello &quot; (&lt;em&gt;params&lt;/em&gt; :name)))&lt;br&gt;&lt;br&gt;By using local bindings, I ensure that people need to explicitly choose which parts of the request they want to use. I&#039;m of the opinion that by removing unnecessary information early, you limit the amount of things that can go wrong.&lt;br&gt;&lt;br&gt;But I&#039;ve never been happy with using magic variables in this way. So in the &quot;refactor&quot; branch of the Compojure repository I&#039;m trying a different approach. I&#039;m adding an extra argument to the route macros that determines the binding. Clojure&#039;s binding syntax is quite sophisticated, so I can do something like:&lt;br&gt;&lt;br&gt;    (GET &quot;/book/:isbn&quot; {{:keys [isbn]} :params}&lt;br&gt;      (get-book isbn))&lt;br&gt;&lt;br&gt;So now the variables are all explicitly bound. However, it&#039;s still rather verbose, especially since 99% of the time, you&#039;ll likely only want to access the parameters. So I&#039;ve added some syntax sugar for handling parameters:&lt;br&gt;&lt;br&gt;    (GET &quot;/book/:isbn&quot; [isbn]&lt;br&gt;      (get-book isbn))&lt;br&gt;&lt;br&gt;If a vector binding is passed instead, Compojure treats it as a binding of parameters. I think this should cover the vast majority of cases. Things like sessions I&#039;m thinking should be handled by global vars bound in middleware.&lt;br&gt;&lt;br&gt;I&#039;d be interested in your opinion on this syntax. Can you pick any holes in it?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The &#8220;magic&#8221; local bindings in Compojure are also a feature I don&#39;t particularly like; and I wrote that piece of code. It was the least worst solution I could think of at the time.<br /><br />The reason I used local bindings, rather than thread-local vars, is because I didn&#39;t want the request map to be passed implicitly to the controller functions, like so:<br /><br />    (defn do-something []<br />      (str &#8220;Hello &#8221; (<em>params</em> :name)))<br /><br />By using local bindings, I ensure that people need to explicitly choose which parts of the request they want to use. I&#39;m of the opinion that by removing unnecessary information early, you limit the amount of things that can go wrong.<br /><br />But I&#39;ve never been happy with using magic variables in this way. So in the &#8220;refactor&#8221; branch of the Compojure repository I&#39;m trying a different approach. I&#39;m adding an extra argument to the route macros that determines the binding. Clojure&#39;s binding syntax is quite sophisticated, so I can do something like:<br /><br />    (GET &#8220;/book/:isbn&#8221; {{:keys [isbn]} :params}<br />      (get-book isbn))<br /><br />So now the variables are all explicitly bound. However, it&#39;s still rather verbose, especially since 99% of the time, you&#39;ll likely only want to access the parameters. So I&#39;ve added some syntax sugar for handling parameters:<br /><br />    (GET &#8220;/book/:isbn&#8221; [isbn]<br />      (get-book isbn))<br /><br />If a vector binding is passed instead, Compojure treats it as a binding of parameters. I think this should cover the vast majority of cases. Things like sessions I&#39;m thinking should be handled by global vars bound in middleware.<br /><br />I&#39;d be interested in your opinion on this syntax. Can you pick any holes in it?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://zef.me/2650/on-language-design-magic-variables-in-compojure/comment-page-1#comment-3590</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 07 Jan 2010 23:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://zef.me/?p=2650#comment-3590</guid>
		<description>&lt;p&gt;While I do agree with your principles, there is more than one way to view the disappearing variables issue.  Having them only available from directly within the handler forces the developer to explicitly pass only the data necessary in generating a response to further function calls.  This data can include the request itself, but typically it would just be the parameters and session values of note.  This way the intent of functions remains clear and there are no unintentional dependencies on variables that are context dependent.  I think Rich called the danger here &quot;action from afar&quot; in reference to dynamic thread local bindings.&lt;br&gt;That being said, I hate magic local variables that appear from nowhere just as much as you do :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>While I do agree with your principles, there is more than one way to view the disappearing variables issue.  Having them only available from directly within the handler forces the developer to explicitly pass only the data necessary in generating a response to further function calls.  This data can include the request itself, but typically it would just be the parameters and session values of note.  This way the intent of functions remains clear and there are no unintentional dependencies on variables that are context dependent.  I think Rich called the danger here &#8220;action from afar&#8221; in reference to dynamic thread local bindings.<br />That being said, I hate magic local variables that appear from nowhere just as much as you do :)</p>]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->