guile-user
[Top][All Lists]
Advanced

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

Re: null terminated strings


From: Roland Orre
Subject: Re: null terminated strings
Date: Fri, 16 Jan 2004 12:02:09 +0100

On Fri, 2004-01-16 at 11:17, Andreas Voegele wrote:
> Roland Orre writes:
> 
> > On Fri, 2004-01-16 at 10:10, Andreas Voegele wrote:
> >
> >> "Remove calls to SCM_STRING_COERCE_0TERMINATION_X.  Since the
> >> substring type is gone, all strings are 0-terminated anyway."
> >
> > Such a statement is very worrying. What happened to the promises
> > that all substrings will be shared strings?
> 
> I'm new to Guile.  I don't know why shared strings were removed from
> Guile, but things were probably simplified greatly by this decision.
> I think that it is very useful to zero terminate all strings since
> embedding and extending Guile becomes easier.

During all years I've used scm and later guile (I think 14 years now)
I have very very rarely had any need for null terminated strings. There
is a function in guile to convert a null terminated string to a guile
string, this I've used a few times. In C programming I often don't
rely on null terminated strings either as there are many C library
functions that works with length, which I consider more elegant. The
absence of shared substrings on the other hand means a lot of special
code to be able to do something similar without having to copy and
create strings all the time. For instance in a conversion routine for
fixed data base tables I made some years ago I had first used
substrings. The program took 15 hours to run on a specific table. When
I changed to use shared substrings it took about 1 hour on the same
table. 

I think it is quite bad to have the requirement that guile should rely
on null terminated strings as it is often quite easy to come around 
this from my point of view. In guile 1.6.4 it is also expressed so that
all substrings are intended to become internally shared, which I don't
see have happened yet.

> It seems that you'll have to stick to Thien-Thi Nguyen's Guile
> version, available at http://www.glug.org/, if you need shared
> strings.

OK, I haven't haven't followed his development very carefully, but
maybe I should take a closer look. I don't know if he has catched
up with the functionality with goops and such, which I need for
matrix calculations.

        Best regards
        Roland Orre






reply via email to

[Prev in Thread] Current Thread [Next in Thread]