From 654c0d97c9de4bf25b9facda1278835883555ae0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 22 Jul 2016 14:39:29 +0200 Subject: doc: Mention quoting and keywords. Suggested by Vincent Legoll . * doc/guix.texi (Defining Packages): Remove quasiquote in 'arguments' example. Mention quoting and keywords, with references to Guile's manual. --- doc/guix.texi | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index e7b233d828..393efab6e4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2387,7 +2387,7 @@ package looks like this: (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i")))) (build-system gnu-build-system) - (arguments `(#:configure-flags '("--enable-silent-rules"))) + (arguments '(#:configure-flags '("--enable-silent-rules"))) (inputs `(("gawk" ,gawk))) (synopsis "Hello, GNU world: An example GNU package") (description "Guess what GNU Hello prints!") @@ -2452,12 +2452,44 @@ The @code{arguments} field specifies options for the build system @var{gnu-build-system} as a request run @file{configure} with the @code{--enable-silent-rules} flag. +@cindex quote +@cindex quoting +@findex ' +@findex quote +What about these quote (@code{'}) characters? They are Scheme syntax to +introduce a literal list; @code{'} is synonymous with @code{quote}. +@xref{Expression Syntax, quoting,, guile, GNU Guile Reference Manual}, +for details. Here the value of the @code{arguments} field is a list of +arguments passed to the build system down the road, as with @code{apply} +(@pxref{Fly Evaluation, @code{apply},, guile, GNU Guile Reference +Manual}). + +The hash-colon (@code{#:}) sequence defines a Scheme @dfn{keyword} +(@pxref{Keywords,,, guile, GNU Guile Reference Manual}), and +@code{#:configure-flags} is a keyword used to pass a keyword argument +to the build system (@pxref{Coding With Keywords,,, guile, GNU Guile +Reference Manual}). + @item The @code{inputs} field specifies inputs to the build process---i.e., build-time or run-time dependencies of the package. Here, we define an input called @code{"gawk"} whose value is that of the @var{gawk} variable; @var{gawk} is itself bound to a @code{} object. +@cindex backquote (quasiquote) +@findex ` +@findex quasiquote +@cindex comma (unquote) +@findex , +@findex unquote +@findex ,@@ +@findex unquote-splicing +Again, @code{`} (a backquote, synonymous with @code{quasiquote}) allows +us to introduce a literal list in the @code{inputs} field, while +@code{,} (a comma, synonymous with @code{unquote}) allows us to insert a +value in that list (@pxref{Expression Syntax, unquote,, guile, GNU Guile +Reference Manual}). + Note that GCC, Coreutils, Bash, and other essential tools do not need to be specified as inputs here. Instead, @var{gnu-build-system} takes care of ensuring that they are present (@pxref{Build Systems}). -- cgit 1.4.1