ClojureScript

cljs.core/str behavior not consistent with clojure

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    This is the behavior on rhino repl, haven't tested on browser

Description

When running the cljs.core/str function with symbols or keywords the output is not the same as in clojure

ClojureScript:cljs.user> (str "hello" :world)
"hello?'world"

The same happens with symbols, it seems the characters used internally for figuring out if a string is a keyword or symbol are not being escaped correctly on the cljs.core/str function.

  1. CLJS-162.patch
    15/Mar/12 9:18 PM
    0.8 kB
    Roman Gonzalez
  2. CLJS-162_1.patch
    16/Mar/12 11:55 PM
    4 kB
    Roman Gonzalez
  3. CLJS-162_2.patch
    19/Mar/12 5:45 PM
    3 kB
    Roman Gonzalez

Activity

Hide
Roman Gonzalez added a comment -

Added check of symbols and keywords on the private cljs.core/str* function

Show
Roman Gonzalez added a comment - Added check of symbols and keywords on the private cljs.core/str* function
Hide
David Nolen added a comment -

The patch looks good but some tests fail now. Can you address that? Thanks!

Show
David Nolen added a comment - The patch looks good but some tests fail now. Can you address that? Thanks!
Hide
Roman Gonzalez added a comment -

Thanks for checking this out David, I didn't read the developer wiki (my bad), I added a few tests and added a new small function that will allow both str* and str to behave correctly, cheers.

Note: Use CLJS-162_1.patch

Show
Roman Gonzalez added a comment - Thanks for checking this out David, I didn't read the developer wiki (my bad), I added a few tests and added a new small function that will allow both str* and str to behave correctly, cheers. Note: Use CLJS-162_1.patch
Hide
Roman Gonzalez added a comment -

New patch which just replicates the StringBuffer code from `str*` into the `str` implementation.

Show
Roman Gonzalez added a comment - New patch which just replicates the StringBuffer code from `str*` into the `str` implementation.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: