Hi, Andy Wingo <wi...@pobox.com> writes:
> You added a change to foreign-set! for %null-pointer. Would it not make > sense instead to make foreign pointers of type "void" unsettable? Not necessarily. See the test that was added: --8<---------------cut here---------------start------------->8--- (pass-if "foreign-set! other-null-pointer" (let ((f (bytevector->foreign (make-bytevector 2)))) (and (not (= 0 (foreign-ref f))) (begin (foreign-set! f 0) (= 0 (foreign-ref f))) (begin ;; Here changing the pointer value of F is perfectly valid. (foreign-set! f 777) (= 777 (foreign-ref f)))))) --8<---------------cut here---------------end--------------->8--- Here a ((void *) 777) pointer is created. However, this is not allowed for ‘%null-pointer’ because (1) that would change its semantics, and (2) it’s defined as ‘const’ anyway, so modifying it leads to a segfault. Thanks, Ludo’.