chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] utf8 egg and byte-* procedures


From: Jeronimo Pellegrini
Subject: [Chicken-users] utf8 egg and byte-* procedures
Date: Thu, 25 Mar 2010 14:20:43 -0300
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

I'm not sure if I understood how to use the utf8 egg.

#;1> (string-length "áéíóú")
10
#;2> (require-extension utf8)
; loading /usr/local/lib/chicken/5/utf8.import.so ...
; loading /usr/local/lib/chicken/5/scheme.import.so ...
; loading /usr/local/lib/chicken/5/chicken.import.so ...
; loading /usr/local/lib/chicken/5/data-structures.import.so ...
; loading /usr/local/lib/chicken/5/extras.import.so ...
; loading /usr/local/lib/chicken/5/regex.import.so ...
; loading /usr/local/lib/chicken/5/ports.import.so ...
; loading /usr/local/lib/chicken/5/utf8-lolevel.import.so ...
; loading /usr/local/lib/chicken/5/lolevel.import.so ...
; loading /usr/local/lib/chicken/5/utf8.so ...
; loading /usr/local/lib/chicken/5/utf8-lolevel.so ...
#;3> (string-length "áéíóú")
5

It's fine until that point -- now the string-length procedure
is utf8-aware. So that means the egg was loaded and the string
manipulating procedures were redefined.

But the egg documentation mentions that I can use the "byte-"
prefix to get the old non-utf8 procedures (and explicitly mentions
byte-string-length). Now, I suppose they're not visible (or bound)
by default, because:

#;4> (byte-string-length "áéíóú")

Error: unbound variable: byte-string-length

    Call history:

    <syntax>        (byte-string-length "áéíóú")
    <eval>      (byte-string-length "áéíóú")    <--
#;4> 

I have checked the egg source and indeed, the redefinitions are
there (this is from utf8.scm):

(import (rename (except scheme
                        string string->list list->string string-fill!
                        string-ref string-set! write-char read-char)
                (make-string make-byte-string)
                (substring byte-substring)
                (string-length byte-string-length) ;; <=== !!!

Is there something else I have to do in order to have access to the 
old procedures?

I'm using git HEAD, master branch, and version 3.3.0 of the utf8 egg.

Thank you!
J.






reply via email to

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