Hi!

With commit 21c203a, the ‘arguments’ field of packages is automatically
“thunked”–i.e., wrapped in a zero-argument closure.  This allows the
value of ‘arguments’ to refer to the ‘%current-system’ fluid to do all
things system-specific.

Previously, when the value of ‘arguments’ was system-dependent, one had
to write:

  (arguments (lambda (system)
               (if (string=? system "i686-linux")
                   ...)))

Now, one can just write:

  (arguments (if (string=? (%current-system) "i686-linux")
                 ...))

... and ‘%current-system’ is called within the dynamic extent of
‘package-derivation’ (IOW, it does the right thing, if you prefer. ;-))

Yet, ‘package-arguments’ always returns a list, transparently calling
the thunk.

This leads to a more concise style, simplifies code in many places, and
is more extensible (for instance, adding (%cross-system) when
cross-compilation is supported will be trivial.)

You should now run ‘make clean && make’.

I think I have converted all the places that had a lambda as their
‘arguments’, or that tested the return type of ‘procedure-arguments’,
but I could have left some.  So please report any issues!

Eventually I’ll change other fields to be thunked, such as ‘inputs’.

Thanks,
Ludo’.

Reply via email to