Here's a complex example using clojure.reflect, the intent of which was to
create a macro that emits type-hints for the actual constructors that are
available, to resolve ambiguity when there are multiple constructors with
the same number of arguments that differ in type.

https://github.com/gtrak/interop/blob/master/src/interop/core.clj

On Fri, May 27, 2016 at 1:25 PM Gary Trakhman <gary.trakh...@gmail.com>
wrote:

> Yes, you'll have to use the reflection API to create a class dynamically.
>
> https://docs.oracle.com/javase/tutorial/reflect/member/ctorInstance.html
>
> On Fri, May 27, 2016 at 1:24 PM hiskennyness <kentil...@gmail.com> wrote:
>
>> qooxdoo lets us supply oft-used widget parameters to the constructor. For
>> example, a button can specify its label and icon at new time. And this
>> works fine from cljs:
>>
>>    (new qx.ui.mobile.form.Button "Go!") ;; label is the first arg
>>
>> But I am wrapping qooxdoo in something more concise and want to be able
>> to code:
>>
>>    (qxia/make (::Button "Go!")
>>       ..other init params to be "set"
>>
>> Unfortunately I cannot even
>>
>>    (new (qx-class qia-type)) ;; computed class
>>
>> Let alone
>>
>>    (apply new (qx-class qxia-type) make-inits)
>>
>> Not that I thought I would get away with it. :) I grok new is special.
>>
>> I can fall back on the qooxdoo API and use setLabel and setIcon, but I
>> like learning so I thought I would ask if there were some way to:
>>
>>    1. compute a class (preferably by first constructing a name) and/or
>>    2. do the moral equivalent of applying new to parameters
>>
>> -hk
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to