Fork me on GitHub
Alex Miller (Clojure team)15:01:42

if anyone has opinions on cljs-related questions in the state of clojure survey, would welcome your feedback on questions just asked in #clojure-survey


@alexmiller are you asking about cljc dev btw?

Alex Miller (Clojure team)15:01:43

generally, asking about all Clojure/ClojureScript development, but there is no specific question regarding cljc right now. if you have a more specific idea, please take it to #clojure-survey to discuss


Hello; does anyone know why the following code behaves the way it does?

(def class (js/eval "class MyClass {}; MyClass;"))
(new class) ;; Works

(new (js/eval "class MyClass {}; MyClass;")) ;; Execution error (TypeError) at (<cljs repl>:1). eval is not a constructor
It's stemming from me wanting to do the following code:
(def ^:private code-that-works
  (let [ctr (gobj/get AWS "S3")]
    (new ctr (clj->js {:signatureVersion "v4"}))))

(def ^:private code-that-doesnt-work
  (new (gobj/get AWS "S3") 
       (clj->js {:signatureVersion "v4"})))


new working with anything other than a literal constant symbol is likely undefined behavior


@dehli new has to be given some symbol, but can be local, so you could assign the result of the eval to a let binding and that should probably work

👍 4
thanks2 4