On Friday, May 27, 2016 at 10:57:05 PM UTC-4, Brandon Bloom wrote:
>
> The new operation intentionally demands a statically knowable type to
> construct. While this is true of Java as well, it's not true of JavaScript.
> However, it is true of the Google Closure compiler's "type system" for
> advanced compilation. That said, if the library you're using isn't going to
> be optimized with advanced, you can do any typical dynamic metaprogramming
> you'd want to do in JavaScript and call in to that.
>
> mynamespace.make = function(cls) {
> return new (Function.prototype.bind.apply(cls, arguments));
> };
>
> Then from ClojureScript:
>
> (apply mynamespace/make qx.ui.mobile.form.Button ["Go!"])
>
>
Looking at this for the third time I am not sure what held me back the
first two times.
Thx, I'll give it a shot. This keeps coming up where qooxdoo decides some
things should be constructor params instead of properties.
-kt
>
> On Friday, May 27, 2016 at 10:24:12 AM UTC-7, hiskennyness 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.