ClojureScript

Colon characters in symbols don't look to be interpreted correctly in compiled code

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    OSX 10.7

Description

Compiled javascript source files are not outputting the colon character correctly. I have a feeling that this might have something to do with closure-latest (bootstrapped as of 28th Nov)

the cljs source

`(def colon-test [:symbol-name])`

outputs

`cljs.user.colon_test = cljs.core.Vector.fromArray(["﷐'symbol-name"]);`

Activity

Hide
Benjamin Conlan added a comment - - edited

using: `(def colon-test [":symbol-name"])`
outputs: `cljs.user.colon_test = cljs.core.Vector.fromArray([":symbol-name"]);`

which as outlined in the differences from clojure (https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure) stating that they are javascript string is a simple work around.

As such, this issue should be lowered to minor.

Show
Benjamin Conlan added a comment - - edited using: `(def colon-test [":symbol-name"])` outputs: `cljs.user.colon_test = cljs.core.Vector.fromArray([":symbol-name"]);` which as outlined in the differences from clojure (https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure) stating that they are javascript string is a simple work around. As such, this issue should be lowered to minor.
Hide
Benjamin Conlan added a comment - - edited

I've just noticed on the mailing list this is identified using the

'
character also:

http://groups.google.com/group/clojure/browse_thread/thread/b4f0c335067ca74d/36d34b5d151d2ad0?lnk=gst&q=clojurescript+core#36d34b5d151d2ad0

The solution seems to be to use a page encoding of utf-8 (which is great when using javascript in a browser).

Show
Benjamin Conlan added a comment - - edited I've just noticed on the mailing list this is identified using the
'
character also: http://groups.google.com/group/clojure/browse_thread/thread/b4f0c335067ca74d/36d34b5d151d2ad0?lnk=gst&q=clojurescript+core#36d34b5d151d2ad0 The solution seems to be to use a page encoding of utf-8 (which is great when using javascript in a browser).
Hide
David Nolen added a comment -

Keywords and symbols are just JavaScript strings with a special unicode code character. ClojureScript requires the utf-8 meta tag to function properly in most browsers.

Show
David Nolen added a comment - Keywords and symbols are just JavaScript strings with a special unicode code character. ClojureScript requires the utf-8 meta tag to function properly in most browsers.
Hide
Benjamin Conlan added a comment -

Yes, again I've just found this link http://groups.google.com/group/clojure/browse_thread/thread/6613fcf1a9129c3a which clarifies the logic.

I noticed that closure has a `--charset=[charset-name]` flag which might help me out as i'm not playing with this stuff in a browser (at least for the moment).

Show
Benjamin Conlan added a comment - Yes, again I've just found this link http://groups.google.com/group/clojure/browse_thread/thread/6613fcf1a9129c3a which clarifies the logic. I noticed that closure has a `--charset=[charset-name]` flag which might help me out as i'm not playing with this stuff in a browser (at least for the moment).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: