<!-- 
RSS generated by JIRA (4.4#649-r158309) at Sat May 25 21:21:42 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/CLJS-463/CLJS-463.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>[CLJS-463] Google Closure Class interop form (genclass)</title>
                <link>http://dev.clojure.org/jira/browse/CLJS-463</link>
                <project id="10040" key="CLJS">ClojureScript</project>
                        <description>&lt;p&gt;Currently it&apos;s not really possible to use to the existing deftype/record to construct &quot;classes&quot; that interop well with Google Closure. It seems odd to ship Closure and then provide no tools for writing ClojureScript against it, especially the UI component parts. Several people have asked for this now so perhaps we really should offer the ClojureScript equivalent of genclass.&lt;/p&gt;</description>
                <environment></environment>
            <key id="15978">CLJS-463</key>
            <summary>Google Closure Class interop form (genclass)</summary>
                <type id="4" iconUrl="http://dev.clojure.org/jira/images/icons/improvement.gif">Enhancement</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="1" iconUrl="http://dev.clojure.org/jira/images/icons/status_open.gif">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="-1">Unassigned</assignee>
                                <reporter username="dnolen">David Nolen</reporter>
                        <labels>
                    </labels>
                <created>Sat, 26 Jan 2013 12:43:10 -0600</created>
                <updated>Sat, 11 May 2013 15:17:34 -0500</updated>
                                                                            <due></due>
                    <votes>2</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="31083" author="dspiteself@gmail.com" created="Sat, 11 May 2013 15:06:49 -0500"  >&lt;p&gt;What do you think of this approach based on&lt;br/&gt;
based on &lt;a href=&quot;http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/&quot;&gt;http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While it may not preserve enough of gen-class&apos;s semantics. This would be enough for us to start gradually porting our large GClosure code base to Clojurescript. The code size reduction would be enormous. &lt;/p&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;sample_use&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(ns com.example
  (:require [goog.ui.tree.TreeControl :as TreeControl]))
(gen-class
  :name DemoTree
  :&lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; goog/ui.tree.TreeControl
  :constructor ([name config]
                 (goog/base (js* &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;&quot;&lt;/span&gt;) name config))
  :methods [[handleKeyEvent [e]
              (goog/base (js* &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;&quot;&lt;/span&gt;) &lt;span class=&quot;code-quote&quot;&gt;&quot;handleKeyEvent&quot;&lt;/span&gt; e)
              ;; my special code to handle the key event
    ]])&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;here is a untested mock implementation modified from &lt;a href=&quot;http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/&quot;&gt;http://www.50ply.com/blog/2012/07/08/extending-closure-from-clojurescript/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I changed constructors to constructor because there can be only one in js&lt;/p&gt;

&lt;p&gt;This unfortunately has different semantics from gen-class because the original did not include the definition of the methods and constructor inline. It tried to read the Clojure gen-class source,but I still do not yet understand how the :prefix grabbing of functions from the current namespace works from within a macro.&lt;/p&gt;



&lt;p&gt;For Google Closure interop each class should have its own provide&lt;/p&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;dryrun_for_gen-class&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(defmacro gen-class [{&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt;-type :name base-type :&lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ctor :constructor methods :methods}]
  `(&lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt;
     ;(goog/provide ~@(str *ns* &lt;span class=&quot;code-quote&quot;&gt;&quot;.&quot;&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt;-type)) 
     (defn ~&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt;-type ~@ctor)

     (goog/inherits ~type ~base-type)

     ~@(map
        (fn [method]
          `(set! (.. ~type -prototype ~(to-property (first method)))
                 (fn ~@(&lt;span class=&quot;code-keyword&quot;&gt;rest&lt;/span&gt; method))))
        methods)))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>
</channel>
</rss>