Mark H Weaver kirjoitti 05.06.2018 klo 23:28:
Hi, Sorry, but your expectation here is simply not fulfilled by Guile's compiler, nor by other modern compilers. In this case: (define-simple-proc make-calculator (((lst-panels (:uniform-list <panel>))) <none> nonpure) (console-display-line "*1*") (force-output) (let* ((attrlist (pango-attr-list-create)) (tmp1 (begin (console-display-line "*2*") (force-output) 0)) (tmp3 (begin (pango-attr-list-insert attrlist (pango-attr-background-new 65535 0 0)) 0)) I omitted the rest of this procedure, but it turns out that the only reference to 'attrlist' is in the initializer for 'tmp3'. After that, there's no guarantee that Guile will retain a reference to 'attrlist'. It probably doesn't. If you need to artificially keep a reference to some object alive, you should store it in a top-level variable, or in a data structure that's referenced by a top-level variable. Those are never optimized away. Mark
Yes, but I think that the attribute still should not be deallocated twice. - Tommi Höynälänmaa