Re: The empty string and other empty strings

2012-01-20 Thread Andy Wingo
On Fri 13 Jan 2012 17:39, Mark H Weaver writes: > Should we defend the legitimacy of this optimization, and ask the R7RS > working group to include explicit language specifying that empty > strings/vectors need not be freshly allocated? It's a worthwhile question IMO. I'll mail scheme-reports.

Re: The empty string and other empty strings

2012-01-16 Thread David Kastrup
Marijn writes: > On 13-01-12 17:39, Mark H Weaver wrote: >> David Kastrup writes: >> >> However, my mind is not set in stone on this. Does anyone else >> here agree with David? Should we defend the legitimacy of this >> optimization, and ask the R7RS working group to include explicit >> langu

Re: The empty string and other empty strings

2012-01-16 Thread Marijn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 13-01-12 17:39, Mark H Weaver wrote: > David Kastrup writes: > > However, my mind is not set in stone on this. Does anyone else > here agree with David? Should we defend the legitimacy of this > optimization, and ask the R7RS working group to in

Re: The empty string and other empty strings

2012-01-13 Thread David Kastrup
Mark H Weaver writes: > David Kastrup writes: > >> l...@gnu.org (Ludovic Courtès) writes: >> >>> Hi Mark, >>> >>> Mark H Weaver skribis: >>> What do other people think? >>> >>> As you said, R5RS makes it clear that there can be several (in the sense >>> of eq?) empty strings, so I think wh

Re: The empty string and other empty strings

2012-01-13 Thread Mark H Weaver
David Kastrup writes: > l...@gnu.org (Ludovic Courtès) writes: > >> Hi Mark, >> >> Mark H Weaver skribis: >> >>> What do other people think? >> >> As you said, R5RS makes it clear that there can be several (in the sense >> of eq?) empty strings, so I think what you did is the right thing. > > Si

Re: The empty string and other empty strings

2012-01-13 Thread David Kastrup
l...@gnu.org (Ludovic Courtès) writes: > Hi Mark, > > Mark H Weaver skribis: > >> What do other people think? > > As you said, R5RS makes it clear that there can be several (in the sense > of eq?) empty strings, so I think what you did is the right thing. Since it uses the same verbiage with reg

Re: The empty string and other empty strings

2012-01-12 Thread Ludovic Courtès
Hi Mark, Mark H Weaver skribis: > What do other people think? As you said, R5RS makes it clear that there can be several (in the sense of eq?) empty strings, so I think what you did is the right thing. Thanks! Ludo’.

Re: The empty string and other empty strings

2012-01-10 Thread David Kastrup
l...@gnu.org (Ludovic Courtès) writes: > Hello Mark, > > Mark H Weaver skribis: > >> l...@gnu.org (Ludovic Courtès) writes: >>> Anyway, it seems that before, you couldn’t get any encoding error for >>> scm_from_stringn ("", "SOME-ENCODING"), whereas now you can. >> >> Good point. I just committe

Re: The empty string and other empty strings

2012-01-10 Thread Ludovic Courtès
Hello Mark, Mark H Weaver skribis: > l...@gnu.org (Ludovic Courtès) writes: >> Anyway, it seems that before, you couldn’t get any encoding error for >> scm_from_stringn ("", "SOME-ENCODING"), whereas now you can. > > Good point. I just committed a change to avoid this. Cool, thanks for the ins

Re: The empty string and other empty strings

2012-01-10 Thread Mark H Weaver
David Kastrup writes: > Mark H Weaver writes: > >> I went ahead and committed this optimization. Empty substrings are now >> always freshly allocated, and never hold a reference to the original >> stringbuf. > > Why would they need an allocation at all? They don't contain > characters. It is

Re: The empty string and other empty strings

2012-01-10 Thread David Kastrup
Mark H Weaver writes: > Mike Gran wrote: >>> Right now it seems that zero-length shared substring of a wide string is >>> wide.  A zero-length substring still shares the stringbuf of the >>> original string. >> [...] >>> What do you think about that?  Do zero-length substrings need to >>> still

Re: The empty string and other empty strings

2012-01-10 Thread Mark H Weaver
Mike Gran wrote: >> Right now it seems that zero-length shared substring of a wide string is >> wide.  A zero-length substring still shares the stringbuf of the >> original string. > [...] >> What do you think about that?  Do zero-length substrings need to >> still share stringbufs with their pare

Re: The empty string and other empty strings

2012-01-10 Thread David Kastrup
Mike Gran writes: >> From: Ludovic Courtès >> A related question: can we have both narrow and wide empty strings? > > The intention is that a string is encoded as wide only if it can't > be encoded as narrow.  So _newly created_ empty strings should only be narrow. >   > Right now it seems that 

Re: The empty string and other empty strings

2012-01-10 Thread Mike Gran
> From: Mark H Weaver >> What do you think about that?  Do zero-length substrings need to >> still share stringbufs with their parent strings? > > I think the answer is: no they don't, and avoiding that might be a > worthwhile optimization, mainly to avoid needlessly holding a reference > to a

Re: The empty string and other empty strings

2012-01-10 Thread Mark H Weaver
Mike Gran writes: > Right now it seems that zero-length shared substring of a wide string is > wide.  A zero-length substring still shares the stringbuf of the > original string. [...] > What do you think about that?  Do zero-length substrings need to > still share stringbufs with their parent str

Re: The empty string and other empty strings

2012-01-10 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: > Anyway, it seems that before, you couldn’t get any encoding error for > scm_from_stringn ("", "SOME-ENCODING"), whereas now you can. Good point. I just committed a change to avoid this. > A related question: can we have both narrow and wide empty strings?

Re: The empty string and other empty strings

2012-01-10 Thread Mike Gran
> From: Ludovic Courtès > I just noticed that there are i18n.test failures on Hydra, which point > at this commit: > >   http://hydra.nixos.org/build/1790097 > > I think this is under the C locale, but I haven’t been able to reproduce > it yet. > > Anyway, it seems that before, you couldn’t get

Re: The empty string and other empty strings

2012-01-10 Thread Mike Gran
> From: Ludovic Courtès > A related question: can we have both narrow and wide empty strings? The intention is that a string is encoded as wide only if it can't be encoded as narrow.  So _newly created_ empty strings should only be narrow.   Right now it seems that zero-length shared substring of