guile-devel
[Top][All Lists]
Advanced

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

RE: [PATCH 1/3] Make string-length documentation more correct


From: Andrew Tropin
Subject: RE: [PATCH 1/3] Make string-length documentation more correct
Date: Wed, 26 Jun 2024 15:18:59 +0400

On 2024-06-25 13:27, Maxime Devos wrote:

>  >-Returns the number of characters in the given @var{string}.
> +Returns the number of bytes in the given @var{string}.
>  
> This is false. For example, (string-length "😀") is 1, whereas in all 
> encodings I know of it is more than one byte. Also, R5RS says:

Maybe `the number of codepoints` will work here.

(string-length "👨‍🏭") ;; => 3
(string-length "é") ;; => 2

The number of characters here is 1 in both cases.

>
>>procedure: string-length string
>>Returns the number of characters in the given string.
>
> , not “return the number of bytes”. Without mentioning the encoding, the 
> “number of bytes” would be ill-defined anyways.

-- 
Best regards,
Andrew Tropin

Attachment: signature.asc
Description: PGP signature


reply via email to

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