The str function should handle JavaScript symbols

Description

The str function should handle primitive JavaScript symbols produced by Symbol.for. At the moment the str function raises an exception, because it runs into some JavaScript safety checks by using implicit string coersion via (.join #js [x] "").
More info on the safety check here: http://www.2ality.com/2014/12/es6-symbols.html
This ticket is also related to:

Calling the toString method on a symbol directly works

Environment

None

Attachments

1

Activity

Show:

Thomas Heller November 20, 2017 at 12:43 PM

There is a lot of history behind the str fn/macro and why they do what they to.

See: https://dev.clojure.org/jira/browse/CLJS-890

The patch just uses toString which is not an option until we sort out CLJS-890.

Mike Fikes November 20, 2017 at 3:09 AM

Unit tests fail in (presumably older environments) in Travis:

JavaScriptCore:

Nashorn:

Since this appears to only affect the tests, and not the production code, perhaps the tests could be conditional on (exists? js/Symbol).

Details

Assignee

Reporter

Patch

Code and Test

Priority

Created April 21, 2016 at 10:19 PM
Updated November 20, 2017 at 12:43 PM