[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strings and char arrays (Re: #\a octothorpe syntax vs SRFI 10)



From: Aubrey Jaffer <agj@xxxxxxxxxxxx>
Subject: Re: #\a octothorpe syntax vs SRFI 10
Date: Sat,  1 Jan 2005 23:34:06 -0500 (EST)

>  | >                 char (string)                   #nA:char
>  | 
>  | Is that 8-bit chars or implemention-defined chars?
> 
> Those are Scheme chars (implementation-defined).  Multi-lingual
> implementations might have several sizes seamlessly switched behind
> the scenes depending on the characters written into them.

The new draft (srfi-58-new.html) still says:

  "All implementations must support the character array type, 
  the rank-1 character arrays being strings."

As Bear pointed out in <Pine.LNX.4.58.0412301550550.3862@xxxxxxxxxxxxxx>,
a string may not be implemented as a simple array of characters.
It is always possible to implement array operations on strings
since they can be accessed by index.  However, having distinct
character array objects may be good in some implementations
where strings have indexed access costs more than O(1).  

Are you suggesting that a string _should_ be an array of
characters, or did you just included it because of convenience?
Whichever, it'd be nice that the design choice is noted
in the Rationale section, and warn the readers that they can't
count on O(1) indexed access for character arrays (if you
keeps rank-1 character array and string equivalence).

--shiro