Make instances of js/Symbol printable

Description

At the moment instances of js/Symbol are not printable. Trying to
print them or enter them in the REPL causes an exception.

Symbols are supported in all major browsers, except Internet Explorer and Nashorn.
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol

Environment

None

Attachments

1

Activity

Show:

Mike Fikes November 20, 2017 at 1:54 AM

Patch no longer applies.

Roman Scherer April 21, 2016 at 11:12 PM

Since one can still make so called Symbol wrapper objects via the
Object() function [1], I added one more test case for this:

Also the updated patch defines the test case only if js/Symbol exists?
in the JavaScript engine.

[1] https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Symbol

Roman Scherer April 21, 2016 at 10:20 PM

Thanks Francis, I'll take a look at this discussion.

Francis Avila April 21, 2016 at 9:35 PM

Changing str to use .toString is not possible because of CLJS-847: there are unconfirmable reports that .toString() causes TypeError on Safari 6.0.5.

This problem has spilled over into the unresolved CLJS-890. This is a long thread, so see my recap comment, my failed efforts to reproduce the bug and my proposed final patch, which can be easily extended for the symbol case with a new "symbol" clause in the case statement.

Fixed

Details

Assignee

Reporter

Patch

Code and Test

Priority

Created April 20, 2016 at 1:33 PM
Updated March 31, 2020 at 4:41 PM
Resolved March 31, 2020 at 4:41 PM