Clojurians
#cljs-dev
<
2017-10-16
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

mikethompson04:10:41

Question Are the rules around cljs->js name munging fixed/reliable/standardised? For example: currently, above-threshold? is munged into above_threshold_QMARK_. To what extent can I rely on the munging "formula" staying the same into the future? Background Onyx allows you to identify functions with keywords. For example, in their information model you can have a (map) entry like this:

:flow-predicate   :my.ns/above-threshold?
Which says to use the function above-threshold? found in the namespace my.ns. Onyx is Clojure running on the JVM. This obviously requires the mapping of namespaced keywords to functions at runtime, in a way that matches original compilation. So, I'm wondering if this is possible in CLJS? Is the method by which ClojureScript names get munged into javascript names reliable/standard/fixed? Or is this all implementation detail, subject to revision and not to be relied upon?

thheller05:10:45

@mikethompson the name will not be available at runtime for :advanced optimized code unless the function uses ^:export

thheller05:10:21

but besides that the munge function hasn’t changed in forever

mikethompson06:10:14

@thheller oh, of course. :advanced. Hmm. Thanks.

thheller06:10:57

maybe you could create some tooling to deal with that if you have the onyx configuration available at CLJS compile time

favila13:10:07

Goog.reflect has some interesting named methods that may help @mikethompson but you would have to experiment

john18:10:24

@mikethompson If you maintain identical artifacts on both sides of whatever you're doing, you can pull out the munged name off of the .toString of above-threshold? even in :advanced

mikethompson21:10:08

@favila @john thankyou