[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] CHICKEN in production
From: |
John Cowan |
Subject: |
Re: [Chicken-hackers] CHICKEN in production |
Date: |
Wed, 8 Oct 2014 11:54:06 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Peter Bex scripsit:
> It was discussed before on this list, and I shot it down due to
> the danger, however I think it may be possible to change the string
> representation to always include a \0 at the end, so that passing it
> to C will simply be a matter of passing a pointer.
+1 to that.
> The danger could be avoided by a taint bit: if the string is known
> to not contain \0, it can be passed directly. Otherwise, it needs to
> be checked and marked if it's safe. If it's unsafe, an exception can
> be thrown.
IMO the better approach is simply to forbid NUL in strings altogether.
It has no semantics as a character: there is never any situation in which
you need the NUL character as opposed to the 0 byte in a bytevector.
The R7RS was worded to allow implementations to do this.
> The upshot of this is that a string will need to be checked at most
> once, and never copied (except as is done normally, by the GC).
Well, string-set! and string-fill! and the like would have to check
for inserting NUL and either set the taint bit (if you really want
to keep such strings available) or barf.
--
John Cowan http://www.ccil.org/~cowan address@hidden
If [Tim Berners-Lee] has seen farther than others,
it is because he is standing on a stack of dwarves. --Mike Champion
- Re: [Chicken-hackers] CHICKEN in production, (continued)
- Re: [Chicken-hackers] CHICKEN in production, r, 2014/10/07
- Re: [Chicken-hackers] CHICKEN in production, Alex Shinn, 2014/10/07
- Re: [Chicken-hackers] CHICKEN in production, r, 2014/10/09
- Re: [Chicken-hackers] CHICKEN in production, Alex Shinn, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Felix Winkelmann, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Alex Shinn, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Peter Bex, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Daniel Leslie, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Peter Bex, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Daniel Leslie, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production,
John Cowan <=
- Re: [Chicken-hackers] CHICKEN in production, Peter Bex, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Jörg F. Wittenberger, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Peter Bex, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Jörg F. Wittenberger, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, John Cowan, 2014/10/08
- Re: [Chicken-hackers] CHICKEN in production, Jörg F. Wittenberger, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Christian Kellermann, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Jörg F. Wittenberger, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Christian Kellermann, 2014/10/10
- Re: [Chicken-hackers] CHICKEN in production, Jörg F. Wittenberger, 2014/10/10