~ruther/guix-local

bce7526f9a7d4e26242d3128157e30c2fa7ecb0c — Ludovic Courtès 11 years ago 1b09031
Add comments about global memoization.

* guix/build-system/gnu.scm (standard-inputs): Add comment about
  misplaced memoization.
* guix/packages.scm (cache): Likewise.
2 files changed, 5 insertions(+), 0 deletions(-)

M guix/build-system/gnu.scm
M guix/packages.scm
M guix/build-system/gnu.scm => guix/build-system/gnu.scm +3 -0
@@ 250,6 250,9 @@ derivations for SYSTEM.  Include propagated inputs in the result."
                           inputs))))

(define standard-inputs
  ;; FIXME: Memoization should be associated with the open store (as for
  ;; 'add-text-to-store'), otherwise we get .drv that may not be valid when
  ;; switching to another store.
  (memoize
   (lambda (system)
     "Return the list of implicit standard inputs used with the GNU Build

M guix/packages.scm => guix/packages.scm +2 -0
@@ 527,6 527,8 @@ recursively."
(define (cache package system thunk)
  "Memoize the return values of THUNK as the derivation of PACKAGE on
SYSTEM."
  ;; FIXME: This memoization should be associated with the open store, because
  ;; otherwise it breaks when switching to a different store.
  (let ((vals (call-with-values thunk list)))
    ;; Use `hashq-set!' instead of `hash-set!' because `hash' returns the
    ;; same value for all structs (as of Guile 2.0.6), and because pointer