Clojure

references to a symbol ending with ? that came from a foreign namespace confuses the compiler inside a :cljc block

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: Release 1.7, Release 1.8
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I've found a situation where I'm requiring a om.tempid on a .cljc namespace. The require is
[om.tempid :as tempid :refer [tempid?]]
The reference of tempid? on line 24 of bug.cljc generates
java.lang.IllegalArgumentException: Unable to resolve classname: clojure.core$boolean@7521bffd, compiling/home/geraldo/bug/src/bug/bug.cljc:14:5)

To circumvent I've created a local alias of the tempid? function (line 26). It seems that the ? at the end of the name is causing the trouble because if I reference om.tempid/tempid it does not trigger. Note that the local alias was ended with ? to show that only when is a foreign ns that the problem is present.

Regards and forgive my english.

Geraldo Lopes de Souza

  1. bug.cljc
    13/Jan/16 8:15 AM
    2 kB
    Geraldo Lopes de Souza
  2. bug.tar.bz2
    13/Jan/16 8:15 AM
    3 kB
    Geraldo Lopes de Souza

Activity

Hide
Alex Miller added a comment -

tempid? is:

(defn ^boolean tempid? [x]
  (instance? TempId x))

I suspect the ? has nothing to do with it and it's the ^boolean type hint that's the issue.

Show
Alex Miller added a comment - tempid? is:
(defn ^boolean tempid? [x]
  (instance? TempId x))
I suspect the ? has nothing to do with it and it's the ^boolean type hint that's the issue.
Hide
Alex Miller added a comment -

This is a bug in Om in using a type hint in non-conditional code that is cljs-specific. David Nolen is fixing in Om.

Show
Alex Miller added a comment - This is a bug in Om in using a type hint in non-conditional code that is cljs-specific. David Nolen is fixing in Om.
Hide
Geraldo Lopes de Souza added a comment -

Alex,

I saw the other issue referencing the ^boolean but I didn't relate with this.

Thank you,

Geraldo Lopes de Souza

Show
Geraldo Lopes de Souza added a comment - Alex, I saw the other issue referencing the ^boolean but I didn't relate with this. Thank you, Geraldo Lopes de Souza

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: