allow '/' as a protocol method name in cljs

162 views
Skip to first unread message

henry w

unread,
Mar 1, 2018, 2:58:03 AM3/1/18
to Clojure Dev
Hi,

Although the following compiles in cljs (and so 'cljs.div//' exists), an error is thrown on calling the function. It works as expected in Clojure.


(ns cljs.div
(:refer-clojure :exclude [/]))

(defprotocol p
(/ [_]))

(extend-type
#?(:clj String :cljs string)
p
(/ [_] "result"))


; this throws
(/ "")

I've searched jira and not found an existing issue for this but please let me know if I've missed it.

Thanks,
Henry

David Nolen

unread,
Mar 1, 2018, 12:59:05 PM3/1/18
to cloju...@googlegroups.com
Feel free to open a minor issue in JIRA. If you have a patch in mind, please attach it.

Thanks,
David


--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.

henry w

unread,
Mar 1, 2018, 2:51:24 PM3/1/18
to Clojure Dev
On Thursday, March 1, 2018 at 5:59:05 PM UTC, David Nolen wrote:
> Feel free to open a minor issue in JIRA. If you have a patch in mind, please attach it.
>
>
> Thanks,
> David
>
>
> On Wed, Feb 28, 2018 at 9:03 AM, henry w <henr...@gmail.com> wrote:
> Hi,
>
>
>
> Although the following compiles in cljs (and so 'cljs.div//' exists), an error is thrown on calling the function. It works as expected in Clojure.
>
>
>
>
>
> (ns cljs.div
>
>   (:refer-clojure :exclude [/]))
>
>
>
> (defprotocol p
>
>   (/ [_]))
>
>
>
> (extend-type
>
>   #?(:clj String :cljs string)
>
>   p
>
>   (/ [_] "result"))
>
>
>
>
>
> ; this throws
>
> (/ "")
>
>
>
> I've searched jira and not found an existing issue for this but please let me know if I've missed it.
>
>
>
> Thanks,
>
> Henry
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.
>
> To post to this group, send email to cloju...@googlegroups.com.
>
> Visit this group at https://groups.google.com/group/clojure-dev.
>
> For more options, visit https://groups.google.com/d/optout.

Will do, thanks

henry w

unread,
Mar 20, 2018, 6:45:33 PM3/20/18
to Clojure Dev
I've written up my findings so far, but as for a fix it'd be great to get an opinion on whether to start trying to do that in analysis or compilation


Thanks,
Henry

henry w

unread,
May 15, 2018, 3:15:46 AM5/15/18
to Clojure Dev
I've submitted a patch.

Feedback welcome :-)

Thanks,
Henry 
Reply all
Reply to author
Forward
0 new messages