* Thunked package ‘arguments’
@ 2013-01-23 22:35 Ludovic Courtès
2013-01-24 22:36 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: Ludovic Courtès @ 2013-01-23 22:35 UTC (permalink / raw)
To: bug-guix
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’.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Thunked package ‘arguments’
2013-01-23 22:35 Thunked package ‘arguments’ Ludovic Courtès
@ 2013-01-24 22:36 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2013-01-24 22:36 UTC (permalink / raw)
To: bug-guix
ludo@gnu.org (Ludovic Courtès) skribis:
> 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.
Commit dd6b9a3 does the same for ‘inputs’.
Again, make sure to re-run ‘make clean && make’.
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-24 22:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-23 22:35 Thunked package ‘arguments’ Ludovic Courtès
2013-01-24 22:36 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.