Hi Ludovic! l...@gnu.org (Ludovic Courtès) writes: > At the time you were concerned about the “weight” of these macros. Are > you just more relaxed now, or do you have a psyntax optimization in the > pipeline? :-)
I did some experiments, and on my 64-bit system this patch increases the bytecode associated with a record type definition by about 2755 bytes plus 852 bytes per field. I can live with that. >> + (and (equal? (set-fields p >> + ((person-email) "b...@example.com") >> + ((person-address address-country) "Spain") >> + ((person-address address-city) "Barcelona")) > > The choice of towns seems inaccurate. ;-) Heh, good point. I changed "Spain" to "Catalonia" :) >> + (pass-if "set-fields with one path as a prefix of another" >> + (let () >> + (define-immutable-record-type foo (make-foo x) foo? >> + (x foo-x) >> + (y foo-y set-foo-y) >> + (z foo-z set-foo-z)) >> + >> + (define-immutable-record-type :bar (make-bar i j) bar? >> + (i bar-i) >> + (j bar-j set-bar-j)) >> + >> + (catch 'syntax-error >> + (lambda () >> + (compile '(let ((s (make-bar (make-foo 5) 2))) >> + (set-fields s >> + ((bar-i foo-x) 1) >> + ((bar-i foo-z) 2) >> + ((bar-i) 3))) >> + #:env (current-module)) >> + #f) >> + (lambda (key whom what src form subform) >> + (equal? (list key whom what form subform) >> + '(syntax-error set-fields >> + "one field path is a prefix of another" >> + (set-fields s >> + ((bar-i foo-x) 1) >> + ((bar-i foo-z) 2) >> + ((bar-i) 3)) >> + (bar-i))))))))) > > You might want to use ‘pass-if-equal’ here, for better reporting. 'pass-if-equal' seems inapplicable here, since I'm testing for an exception. 'pass-if-exception' was closer to what I needed, but I wanted to verify more than just the exception key. > Please commit, I’ll take care of the doc. Done, and thanks :) Mark