This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see StringSymbolConversion in WG2's repo for R7RS-large.

String­Symbol­Conversion

cowan
2014-12-28 10:26:33
3history
source

I tested how Schemes deal with string->symbol when the string contains characters that can only appear in an escaped symbol. All Schemes in my test suite (except Rep, Schemik, and Oaklisp, which don't support string->symbol) return a symbol from (string->symbol "foo)(bar") rather than a syntax error.

An interesting difference was the way in which the resulting symbol was printed by the REPL.

Racket, Gauche, MIT, Gambit, Chicken, SISC, Chibi, STklos, Sagittarius printed the symbol name as |foo)(bar|.

Guile, Chez, Icarus/Vicare, Larceny, Ypsilon, KSi printed it as foo\x29;\x28;bar, R6RS-style.

SCM, Shoe, Elk printed it as foo\)\(bar.

Bigloo, Scheme48/scsh, Kawa, Mosh, IronScheme, NexJ, SigScheme, TinyScheme, Scheme 9, Dream, RScheme, S7, BDC, XLisp, UMB, VX, Owl Lisp displayed the symbol as foo)(bar (this is arguably a bug in Mosh and IronScheme, which are R6RS implementations).

Note that this list does not match the list of implementations which accept vertical bars, hex escapes, and backslashes.