Ticket #47 (closed task: fixed)

Opened 10 months ago

Last modified 3 months ago

Change string representation to char[]

Reported by: JarrettBillingsley Assigned to: JarrettBillingsley
Priority: normal Milestone: MiniD 2
Component: Interpreter Keywords:
Cc:

Description (Last modified by JarrettBillingsley)

I've changed this from mstring to char[] and re-upped the importance. Using dchar[] is constantly a pain in the ass, mostly because most other D code (and most system APIs) use char[]. Using char[] to represent strings still allows for all valid Unicode strings at the cost of slicing and indexing becoming an O(n) operation. But given that strings are immutable, their lengths can be known in advance, and their validity only has to be checked once. As long as the language sees it as a sequence of UTF-32 codepoints..

I did also give one of the record schemes some thought, but I have a feeling they'd be more trouble than they're worth, because although they save memory and offer O(1) slicing and indexing, they are a nonstandard encoding and would have to be transcoded for use with virtually all other libraries.

Change History

02/03/08 21:07:59 changed by r.lph50

Or even something like record1 in Larceny Scheme?

Seen in factor

02/07/08 22:51:26 changed by JarrettBillingsley

Scary! :o

07/20/08 00:46:22 changed by JarrettBillingsley

  • priority changed from normal to minor.
  • description changed.
  • summary changed from Change string representation to Chris Miller's dstring to Change string representation to Chris Miller's mstring.

I think that maybe this should be offered as an option, but not as the default. Doing so has fairly far-reaching consequences for the API.

08/25/08 16:46:29 changed by JarrettBillingsley

  • priority changed from minor to normal.
  • description changed.
  • summary changed from Change string representation to Chris Miller's mstring to Change string representation to char[].

08/25/08 16:47:21 changed by JarrettBillingsley

  • description changed.

08/25/08 22:41:12 changed by JarrettBillingsley

  • status changed from new to closed.
  • resolution set to fixed.

(In [352]) Closes #47. Ahh, char[].