Based on CL practice, people have found it useful to have lexical syntax for arrays, bitvectors, and transparent record types in addition to the ones in Scheme. But I realized that every time we introduce a novel lexical syntax for the various container types of the large language (I don't mean a variant like #vu8 vs #u8), we have to deal with the existence of mutable and immutable variants of the underlying data types. I had been hoping to put off the question of lexical syntax, as it will require a unified design, but for every such lexically representable type, there will need to be some way for the standard library functions of that type to return mutable or immutable values.
-
We can say that
readandevalare the only way to generate immutable values, but this makes it very annoying to use them when immutability is an important property (e.g. when sharing data between threads). -
We can have a function or set of functions that creates an immutable copy of a mutable container, but this not only involves extra data motion, it also makes it hard or impossible for immutable containers to share their contents freely (this is especially important when dealing with immutable strings).
-
We can say that R7RS-large implementations are required to copy lexically apparent containers in code, so that there is no absolute need for immutable objects, although they are still useful for sharing.
I don't like any of these.