<!-- 
RSS generated by JIRA (4.4#649-r158309) at Wed May 22 02:07:41 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-1085/CLJ-1085.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-1085] clojure.main/repl unconditionally refers REPL utilities into *ns*</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-1085</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;A number of vars from &lt;tt&gt;clojure.repl&lt;/tt&gt;, &lt;tt&gt;clojure.java.javadoc&lt;/tt&gt;, and &lt;tt&gt;clojure.pprint&lt;/tt&gt; are unconditionally referred into &lt;tt&gt;&amp;#42;ns&amp;#42;&lt;/tt&gt; by &lt;tt&gt;clojure.main/repl&lt;/tt&gt;.  This is fine when it is being used e.g. as the primary driver of a terminal-bound Clojure REPL, but other usages can end up bringing those utility vars into namespaces other than &lt;tt&gt;&apos;user&lt;/tt&gt;.  This can cause problems if &lt;tt&gt;clojure.main/repl&lt;/tt&gt; is used to drive a REPL within namespaces that already have referred or interned vars with the same names as those utility vars, e.g.:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$ java -jar ~/.m2/repository/org/clojure/clojure/1.5.0-alpha6/clojure-1.5.0-alpha6.jar
Clojure 1.5.0-alpha6
user=&amp;gt; (ns foo)
nil
foo=&amp;gt; (defn pp [] &lt;span class=&quot;code-quote&quot;&gt;&quot;hi!&quot;&lt;/span&gt;)
#&apos;foo/pp
foo=&amp;gt; (pp)
&lt;span class=&quot;code-quote&quot;&gt;&quot;hi!&quot;&lt;/span&gt;
foo=&amp;gt; (clojure.main/repl)
foo=&amp;gt; (pp)
nil
nil
foo=&amp;gt; (defn pp [] &lt;span class=&quot;code-quote&quot;&gt;&quot;whoops&quot;&lt;/span&gt;)
CompilerException java.lang.IllegalStateException: pp already refers to: #&apos;clojure.pprint/pp in namespace: foo, compiling:(NO_SOURCE_PATH:7:1)&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Worse, nREPL uses &lt;tt&gt;clojure.main/repl&lt;/tt&gt; (in large part to maximize the consistency of REPL behaviour across different Clojure versions), where each user expression is evaluated through a separate &lt;tt&gt;clojure.main/repl&lt;/tt&gt; invocation.  This leads to the same problems as above, but for every nREPL user, session, and expression (reported @ &lt;a href=&quot;http://dev.clojure.org/jira/browse/NREPL-31&quot; title=&quot;REPL utilities are refered into *ns* prior to every expression evaluation&quot;&gt;&lt;del&gt;NREPL-31&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;A simple fix for this is to perform these refers only if &lt;tt&gt;&amp;#42;ns&amp;#42;&lt;/tt&gt; is &lt;tt&gt;&apos;user&lt;/tt&gt; (which, AFAICT, was the only intended effect of &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-310&quot; title=&quot;clojure.repl namespace&quot;&gt;&lt;del&gt;CLJ-310&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-454&quot; title=&quot;docstrings for special ops&quot;&gt;&lt;del&gt;CLJ-454&lt;/del&gt;&lt;/a&gt;, and &lt;a href=&quot;https://github.com/clojure/clojure/commit/04764db&quot;&gt;https://github.com/clojure/clojure/commit/04764db&lt;/a&gt;, the changes that added these automatic implicit refers to &lt;tt&gt;clojure.main/repl&lt;/tt&gt;).&lt;/p&gt;</description>
                <environment></environment>
            <key id="15744">CLJ-1085</key>
            <summary>clojure.main/repl unconditionally refers REPL utilities into *ns*</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="-1">Unassigned</assignee>
                                <reporter username="cemerick">Chas Emerick</reporter>
                        <labels>
                    </labels>
                <created>Wed, 10 Oct 2012 13:33:36 -0500</created>
                <updated>Sat, 20 Oct 2012 09:53:42 -0500</updated>
                    <resolved>Sat, 20 Oct 2012 09:53:42 -0500</resolved>
                            <version>Release 1.4</version>
                <version>Release 1.5</version>
                                <fixVersion>Release 1.5</fixVersion>
                                        <due></due>
                    <votes>3</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="29628" author="cemerick" created="Wed, 10 Oct 2012 13:36:52 -0500"  >&lt;p&gt;Patch attached to only refer in the utility vars if in the &lt;tt&gt;user&lt;/tt&gt; namespace.&lt;/p&gt;</comment>
                    <comment id="29629" author="steveminer@gmail.com" created="Wed, 10 Oct 2012 14:03:48 -0500"  >&lt;p&gt;It would probably be better to test with ns-name (as opposed to comparing strings):&lt;/p&gt;

&lt;p&gt;    (= &apos;user (ns-name &lt;b&gt;ns&lt;/b&gt;))&lt;/p&gt;</comment>
                    <comment id="29630" author="hiredman" created="Wed, 10 Oct 2012 14:18:31 -0500"  >&lt;p&gt;I don&apos;t follow how it is required to call `clojure.main/repl` for every input&lt;/p&gt;</comment>
                    <comment id="29631" author="cemerick" created="Wed, 10 Oct 2012 14:19:36 -0500"  >&lt;p&gt;Gah, of course.  :-/  Patch updated.&lt;/p&gt;</comment>
                    <comment id="29632" author="cemerick" created="Wed, 10 Oct 2012 14:32:42 -0500"  >&lt;p&gt;@Kevin: It&apos;s not &lt;em&gt;required&lt;/em&gt;, but I found it far more straightforward to not try to pretend that the underlying transport was stream-based when it&apos;s actually message-based.  It also means that sessions can be very lightweight: unless code is being evaluated within a session, it is not occupying a thread, and takes up only as much space as its map of thread-local bindings.&lt;/p&gt;</comment>
                    <comment id="29649" author="cemerick" created="Mon, 15 Oct 2012 05:10:04 -0500"  >&lt;p&gt;Based on discussion on clojure-dev, I have attached an alternative patch ({{&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJ-1085&quot; title=&quot;clojure.main/repl unconditionally refers REPL utilities into *ns*&quot;&gt;&lt;del&gt;CLJ-1085&lt;/del&gt;&lt;/a&gt;-refactor.diff}}), which:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;breaks out the libspecs specifying the implicit refers into their own var (so that they can be consistently applied by other REPL implementations)&lt;/li&gt;
	&lt;li&gt;moves the default &lt;tt&gt;require&lt;/tt&gt; of the libspecs to be invoked only when REPL is started from &lt;tt&gt;clojure.main&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    <comment id="29696" author="stu" created="Fri, 19 Oct 2012 14:12:51 -0500"  >&lt;p&gt;Screened and liked the second &quot;refactor&quot; patch.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11549" name="CLJ-1085.diff" size="1037" author="cemerick" created="Wed, 10 Oct 2012 14:19:36 -0500" />
                    <attachment id="11560" name="CLJ-1085-refactor.diff" size="1844" author="cemerick" created="Mon, 15 Oct 2012 04:47:37 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10001">Code</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>