unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* #:configure-flags flags #~'() or #:configure-flags flags #~()
@ 2023-01-19  5:29 Feng Shu
  2023-01-19  9:27 ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 4+ messages in thread
From: Feng Shu @ 2023-01-19  5:29 UTC (permalink / raw)
  To: guix-devel


Hello:

I grep guix.git, and find two form, I would like to know which one is
right:

#:configure-flags flags #~'()

or 

#:configure-flags flags #~()



--------------------------------------------------------------------------------
-*- mode: grep; default-directory: "~/guix/guix/" -*-
Grep started at Thu Jan 19 13:26:17

find -H . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo
  -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o \( -path ./\^\\.idea\$ -o -path ./\^\\.vscode\$ -o -path ./\^\\.ensime_cache\$ -o -path ./\^\\.eunit\$ -o -path ./\^\\.git\$ -o -path ./\^\\.hg\$ -o -path ./\^\\.fslckout\$ -o -path ./\^_FOSSIL_\$ -o -path ./\^\\.bzr\$ -o -path ./\^_darcs\$ -o -path ./\^\\.pijul\$ -o -path ./\^\\.tox\$ -o -path ./\^\\.svn\$ -o -path ./\^\\.stack-work\$ -o -path ./\^\\.ccls-cache\$ -o -path ./\^\\.cache\$ -o -path ./\^\\.clangd\$ -o -path ./TAGS \) -prune -o  -type f \( -name \* -o -name .\* \) -exec grep --color=auto -i -nH --null -e \#\:configure-flags\ flags\ \#\~ \{\} +
./gnu/packages/emacs.scm:424:       ((#:configure-flags flags #~'())
./gnu/packages/emacs.scm:445:       ((#:configure-flags flags #~'())
./gnu/packages/emacs.scm:464:       ((#:configure-flags flags #~'())
./gnu/packages/emacs.scm:489:       ((#:configure-flags flags #~'())
./gnu/packages/emacs.scm:508:       ((#:configure-flags flags #~'())
./gnu/packages/gstreamer.scm:1080:         ((#:configure-flags flags #~'())
./gnu/packages/maths.scm:2708:       ((#:configure-flags flags #~'())
./gnu/packages/python.scm:685:        ((#:configure-flags flags #~())
./gnu/packages/serialization.scm:200:       ((#:configure-flags flags #~'())
./gnu/packages/tor.scm:141:       ((#:configure-flags flags #~'())
./gnu/packages/wxwidgets.scm:177:       ((#:configure-flags flags #~'())
./gnu/packages/wxwidgets.scm:228:       ((#:configure-flags flags #~'())
./gnu/packages/freedesktop.scm:208:       ((#:configure-flags flags #~'())

Grep exited abnormally with code 1 at Thu Jan 19 13:26:18



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: #:configure-flags flags #~'() or #:configure-flags flags #~()
  2023-01-19  5:29 #:configure-flags flags #~'() or #:configure-flags flags #~() Feng Shu
@ 2023-01-19  9:27 ` Tobias Geerinckx-Rice
  2023-01-19 11:44   ` Feng Shu
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Geerinckx-Rice @ 2023-01-19  9:27 UTC (permalink / raw)
  To: guix-devel, Feng Shu

Hi!

It's not about 'right' (why would grepping Guix return wrong code...? Impossible! :-).  It's a matter partly of preference and partly of using the best tool for the job.

Omitted from your second example is a call to list, and the #~ that both have in common is just syntactic sugar for (gexp ...).

So the two forms you're comparing are:

  (gexp '("a" "b" "c"))
  (gexp (list "a" "b" "c"))

Both are completely equivalent when they contain only strings.  Choose whichever you like.

When you have several procedures to call, calling 'list' can look cleaner:

  (list (string-append "foo=" bar) "baz")

Although strictly speaking ` uses fewer characters and is just as correct:

  `(,(string-append "foo=" bar) "baz")

Most Guix developers prefer (list ...) because it's more self-explanatory to people unfamiliar with Lisps.  However, 'quoting is such a fundamental building block that it probably matters little in practice.

Your name looks familiar so I'll assume you understand basic Lisps concepts like quote & quasiquote.  If not, I strongly suggest learning the basics, it will make Guix much less mysterious.

As long as configure-flag gets a list, it matters little how you construct it:

  #~(append (list "my" "flags")
            '("are" "many")
           (string-append "colo" "ured"))

Just be consistent.



Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: #:configure-flags flags #~'() or #:configure-flags flags #~()
  2023-01-19  9:27 ` Tobias Geerinckx-Rice
@ 2023-01-19 11:44   ` Feng Shu
  2023-01-19 12:42     ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 4+ messages in thread
From: Feng Shu @ 2023-01-19 11:44 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> Hi!
>
> It's not about 'right' (why would grepping Guix return wrong code...? Impossible! :-).  It's a matter partly of preference and partly of using the best tool for the job.
>
> Omitted from your second example is a call to list, and the #~ that both have in common is just syntactic sugar for (gexp ...).

:-), I just want to know, in below code: we should code #~'() or #~() after flags.

(substitute-keyword-arguments (package-arguments ...)
         ((#:configure-flags flags #~'())
                                   ^^^^^
           ...))



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: #:configure-flags flags #~'() or #:configure-flags flags #~()
  2023-01-19 11:44   ` Feng Shu
@ 2023-01-19 12:42     ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice @ 2023-01-19 12:42 UTC (permalink / raw)
  To: Feng Shu; +Cc: guix-devel

In this example, only #~'() makes sense.  #~() is nonsensical here and will cause a syntax error when ungexped.

Kind regards,

T G-R

Sent on the go.  Excuse or enjoy my brevity.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-19 12:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19  5:29 #:configure-flags flags #~'() or #:configure-flags flags #~() Feng Shu
2023-01-19  9:27 ` Tobias Geerinckx-Rice
2023-01-19 11:44   ` Feng Shu
2023-01-19 12:42     ` Tobias Geerinckx-Rice

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).