Hi, >> 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").
Thanks Peter! That is rather confusing: I thought each module imported its own identifiers and had its own namespace. As string->blob is part of "library" I'm not importing it from anywhere so how would I "except" it? Regards, @ndy -- andy...@ashurst.eu.org http://www.ashurst.eu.org/ 0290 DA75 E982 7D99 A51F E46A 387A 7695 7EBA 75FF
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users