Fork me on GitHub
#clojurescript
<
2019-08-25
>
Abhinav Sharma07:08:26

Hi Guys, could anyone tell me please how can I use goog.string.Stiringifier? Logically speaking this should work (goog.string.stringifier/stringify #js {"a" "A"})

borkdude15:08:02

What does ^not-native mean again? I have trouble finding docs on this (except for some blog posts that allude to something about protocols).

thheller16:08:39

usually the compiler will emit a conditional call to a protocol that first checks if the protocol property exists. not-native tells the compiler to skip that check and blindly call the protocol

thheller16:08:35

foo.some$protocol$prop ? foo.some$protocol$prop(...) : some.protocol.prop(foo) something like that is normal and with not-native it'll call foo.some$protocol$prop(...) directly without checks

borkdude16:08:34

is this expected?

ClojureScript 1.10.520
cljs.user=> (identical? ::eof ::eof)
false
cljs.user=>

Clojure 1.10.1
user=> (identical? ::eof ::eof)
true
user=>

borkdude16:08:43

I know there's keyword-identical?

borkdude16:08:55

but this seems non-obvious

thheller18:08:49

@borkdude yes expected. thats why keyword-identical? exists.

thheller18:08:04

it works that way because JS doesn't have weak references. well until recently.

thheller18:08:37

well and because of :advanced optimizations I guess

dog23:08:26

hey guys, how do I dynamiclly require name spaces in the repl?

#?(:clj
   (defmacro repl! ;;This works
     []
     (require '[shared.repl :as rpl]
              '[clojure.repl :as rl]
              '[cognitect.rebl :as rbl]
              '[clojure.reflect :as reflect]
              '[clojure.java.javadoc :as jdoc])
     (println "-- REPL LOADED --")
     (println "The current namespace is : " *ns*))
   :cljs
   (defmacro repl! ;; no idea how to make it work in cljs
     []
     `(something something)))
I got it working in clj, but not cljs Im thinking that it has to be a macro because when I include require in a fn it complains that require must be in the top level