chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] CHICKEN in production


From: Florian Zumbiehl
Subject: Re: [Chicken-hackers] CHICKEN in production
Date: Mon, 13 Oct 2014 16:35:20 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

> > 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.

IMO, this is a terrible idea. At the core, the reason is simply this: If
your character strings can't store NUL, your character strings can't store
Unicode.

And obviously, Unicode is not an end in itself, but is used by lots of
other standards for the encoding of character data--none of those can be
implemented in a language that can't represent Unicode (at least not using
the built-in character strings--you still could reimplement your own
abstraction, of course, just as you would do for sane data handling in C).

Take JSON as an example: JSON character strings can encode NULs, so if
CHICKEN were to reject NULs in character strings, you could not write a
JSON parser in CHICKEN.

Florian



reply via email to

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