Mike Fikes
2014-06-18 17:56:25 UTC
Is there a way to indicate that a (ClojureScript) protocol is intended to
be used from the host?
Details:
I can define a protocol and an implementation of it in ClojureScript using
defprotocol and reify.
I can also successfully call methods on reified instances returned to the
host (Obj-C embedding JavaScriptCore on iOS).
The method names are mangled: In addition to the expected and usual
conversion of hyphens to underscores, the mangled names incorporate dollar
signs ($) and arity encoding, an example of which is:
my$full$ns$MyProtocol$a_method_defined_in_this_protocol$arity$1
This can be called, passing this mangled string in as the method name of JSValue
-invokeMethod:withArguments:.
All cool (so long as this mangling is stable from one ClojureScript release
to the nextâbut it smells like the mangling could be an implementation
detail, subject to change).
The killer is if I turn on Google Closure advanced optimizations; these
mangled names get renamed.
Is there a way to indicate the protocol names should be preserved?
(Analogous to the way ^:export can be used on function definitions.)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to ***@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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
be used from the host?
Details:
I can define a protocol and an implementation of it in ClojureScript using
defprotocol and reify.
I can also successfully call methods on reified instances returned to the
host (Obj-C embedding JavaScriptCore on iOS).
The method names are mangled: In addition to the expected and usual
conversion of hyphens to underscores, the mangled names incorporate dollar
signs ($) and arity encoding, an example of which is:
my$full$ns$MyProtocol$a_method_defined_in_this_protocol$arity$1
This can be called, passing this mangled string in as the method name of JSValue
-invokeMethod:withArguments:.
All cool (so long as this mangling is stable from one ClojureScript release
to the nextâbut it smells like the mangling could be an implementation
detail, subject to change).
The killer is if I turn on Google Closure advanced optimizations; these
mangled names get renamed.
Is there a way to indicate the protocol names should be preserved?
(Analogous to the way ^:export can be used on function definitions.)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to ***@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+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.