[bitc-dev] Problem: mutable literals

Jonathan S. Shapiro shap at eros-os.org
Fri May 19 08:03:44 EDT 2006


On Fri, 2006-05-19 at 01:26 -0400, Swaroop Sridhar wrote:
> Jonathan S. Shapiro wrote:
> > 1. Special case strings. Strings have constant members (no string-set!),
> > and behave similarly to bignums. Strings are NOT a reference type.
> 
> I don't understand this. If strings are not a reference type, how can 
> they be a value type?
> 
> That is, in order to write
> 
> (define (f x:string) ... ) on strings of all lengths, strings must be a 
> reference type -- at least as a matter of representation. Right?

Yes and no. What I meant here is that strings are like BigNums. As a
matter of implementation they are a reference type, but because they are
immutable they can use reference copy semantics.

> The problem with strings is that when we write
> 
> (define x:(mutable string) "xyz")
> 
> is it the case that x is mutable, or the contents of x is mutable?
> Unlike vectors there is no clear way of specifying this.

This is completely unambiguous. The reference is mutable, not the
content. This is the problem that we are discussing at the moment. I am
trying to determine whether we need a type that covers "string of
mutable characters" within the set of language built-in types. I think
(provisionally) that the answer is "no", but I am not certain.


shap



More information about the bitc-dev mailing list