On Mon, Apr 25, 2016 at 05:55:35PM +0100, Andy Bennett wrote: > Here is my minimal test case: > > ----- > (use message-digest sha2) > > (define (string->blob string) > (abort "no way")) > > (define digest (initialize-message-digest (sha256-primitive))) > > (assert (message-digest? digest)) > > (message-digest-update-object digest "x") > (pp (finalize-message-digest digest 'blob)) > ----- > > This aborts with "no way" during the call to message-digest-update-object. > > > message-digest is expecting to get string->blob from the library > (http://api.call-cc.org/doc/library/string-%3Eblob ) but I'm reusing > that name in my program for something else. > > Even tho' I define my string->blob after I (use message-digest), it > seems to affect the binding in the message-digest code. > > Is this expected behaviour?
Yes, in some cases we even do this intentionally: this is basically performing a set! on an imported identifier, nothing special. To avoid this, simply rename, prefix or omit ("except") the string->blob identifier as you import it. The compiler should give you a warning when you do this, but it only does that when the code is in a module. Try compiling the above program with -M, you'll see the warning (and an error about not importing "extras" to get "pp"). Cheers, Peter
signature.asc
Description: Digital signature
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users