diff --git a/surveys/unreadable-objects.md b/surveys/unreadable-objects.md new file mode 100644 index 0000000..89a75d0 --- /dev/null +++ b/surveys/unreadable-objects.md @@ -0,0 +1,52 @@ +# Unreadable objects + +This is a survey of the lexical syntax that the `write` procedure uses +to write unreadable objects. + +| Implementation | Syntax | Skippable | +|----------------|----------|-----------| +| Chez Scheme | `#<...>` | no | +| Chibi-Scheme | `#<...>` | no | +| Chicken | `#<...>` | no | +| Gambit | `#<...>` | no | +| Gauche | `#<...>` | no | +| Guile | `#<...>` | no | +| Kawa | `#<...>` | no | +| MIT Scheme | `#[...]` | no | +| Mosh | `#<...>` | no | +| Sagittarius | `#<...>` | no | +| STklos | `#[...]` | YES? | +| (Common Lisp) | `#<...>` | no | + +**Skippable** means that the written stand-in object can be parsed as +an S-expression (using the syntax of that implementation) and +therefore skipped to find more S-expressions in the same stream. + +## Conflicts + +Chicken and Gambit support multi-line strings via the following +syntax. (The syntax imitates the Bourne shell, which calls a +multi-line string a "here-document".) + + <`. + +In both cases there is a syntactic ambiguity. Chicken, Gambit, and +Kawa all use `#<` to write unreadable objects. Since valid Scheme +source code cannot contain unreadable objects, there is no read-time +ambiguity for valid code. The ambiguity does make it harder to deal +with invalid input where an unreadable object may be silently +misinterpreted as some type of readable object or rejected with a +confusing error message. + +STklos has a similar syntax `#<` for unreadable data there is no ambiguity. diff --git a/www-index.scm b/www-index.scm index d24cefc..92e87be 100644 --- a/www-index.scm +++ b/www-index.scm @@ -89,6 +89,7 @@ "reader-vertical-bar-concatenated-with-number" "square-brackets" "string-symbol-conversion" + "unreadable-objects" "unsigned-imaginary" "upper-case-escape" "vertical-line-symbols")