[plt-scheme] Default string and byte string representation

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Dec 17 09:11:41 EST 2008

At Wed, 17 Dec 2008 13:05:18 +0100, Jakub Piotr Cłapa wrote:
> Why does Scheme defaults to using octal notation in (byte)string escape 
> codes?

Only byte strings print with octal. Strings print with \u escapes,
right?

Octal is used for byte strings mostly because octal was always used for
byte strings. It does have two minor redeeming qualities: a nul byte
prints relatively compactly as \0 (unless followed by a digit), and
UTF-8 encodings of non-ASCII characters show up as \3oo \2oo ...
sequences (while encodings of ASCII characters never print as \2oo or
\3oo).

> AFAICT more people are familiar with hexadecimal than octal so maybe 
> defaulting to "\xFF" escapes (which are handled correctly on input) 
> would be better? Or maybe a parameter to set that?

I'm reluctant to change the default, because the reward seems low given
the risk of breaking something. But we could add a parameter.


Matthew



Posted on the users mailing list.