[bitc-dev] Primary string type

Swaroop Sridhar swaroop.sridhar at gmail.com
Fri May 19 00:01:02 EDT 2006


Jonathan S. Shapiro wrote:
> On Thu, 2006-05-18 at 23:38 -0400, Swaroop Sridhar wrote:
> 
>>I just noticed that the string type is not listed in
>>Section 3.2 Primary Types. This is probably because we initially defined 
>>string as (vector char) but subsequently changed over to a primitive 
>>string type.
> 
> 
> String isn't a primary type. It is a sequence type.
> 
> That having been said, I agree that it needs to be added. However, what
> to add is not straightforward. We need first to discuss string literals
> and their relationship to mutability.

If I write:

(define x:(mutable string) "abcd")

and then if we say:

(set! x "efgh")

x now points to a different string. x was mutated, not the string. In 
the same sense,

(define y "efgh")

(set! x y)

x and y can point to (since strings cannot be unboxed) the same string.

Also, the total memory consumption in this system is constant because 
once the string literals are created, copies only need to point to 
existing strings. Am I missing something?

However, by string-set!, do you mean that parts of the string can be 
overwritten?

If strings are a sequence type, is there a plan to allow indexing into 
strings?

Swaroop.



More information about the bitc-dev mailing list