chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] read-byte, etc.


From: Hans Bulfone
Subject: Re: [Chicken-users] read-byte, etc.
Date: Mon, 3 Apr 2006 13:11:05 +0200
User-agent: Mutt/1.5.9i

hi,

On Wed, Mar 29, 2006 at 07:06:40PM -0600, Alex Shinn wrote:

> The utf8 egg is a syntax-case module, so even if some other module is
> using it, your code will see the original READ-CHAR.
> 
> People can (import utf8) into the top-level if they want, but this
> isn't always guaranteed to play well with other people's code.  If you
> want to guard against this you can:
> 
> (define read-byte
>   (let ((read-char read-char))
>     (lambda args
>       (let ((ch (apply read-char args)))
>         (if (eof-object? ch)
>           ch
>           (char->integer ch))))))
> 
> which will do the right thing no matter what.

thanks for your suggestion.

i would have also expected this version to be slightly
faster because read-char doesn't need to be looked up
on every invokation... but it got slightly slower;
can anybody explain why?

thanks,
hans.




reply via email to

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