[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Thunked package ‘arguments’
From: |
Ludovic Courtès |
Subject: |
Thunked package ‘arguments’ |
Date: |
Wed, 23 Jan 2013 23:35:12 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
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’.
- Thunked package ‘arguments’,
Ludovic Courtès <=