unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* What's the meaning of the percent sign in variable names
@ 2021-04-23 14:22 Luis Felipe
  2021-04-23 14:49 ` Leo Prikler
  2021-05-04 15:49 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Luis Felipe @ 2021-04-23 14:22 UTC (permalink / raw)
  To: guix-devel

Hi,

Are all these constants (%base-packages, for example)? Is this a Guix convention or does it come from Guile? Although looking at Guile's Variable index I see many constants in uppercase, and also some variables prefixed with the percent sign, while Guix' Programming index doesn't seem to list any uppercase names.


Thanks,

---
Luis Felipe López Acevedo
https://luis-felipe.gitlab.io/


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

* Re: What's the meaning of the percent sign in variable names
  2021-04-23 14:22 What's the meaning of the percent sign in variable names Luis Felipe
@ 2021-04-23 14:49 ` Leo Prikler
  2021-04-24 13:29   ` Luis Felipe
  2021-05-04 15:49 ` Ludovic Courtès
  1 sibling, 1 reply; 5+ messages in thread
From: Leo Prikler @ 2021-04-23 14:49 UTC (permalink / raw)
  To: Luis Felipe, guix-devel

Am Freitag, den 23.04.2021, 14:22 +0000 schrieb Luis Felipe:
> Hi,
> 
> Are all these constants (%base-packages, for example)? Is this a Guix
> convention or does it come from Guile? Although looking at Guile's
> Variable index I see many constants in uppercase, and also some
> variables prefixed with the percent sign, while Guix' Programming
> index doesn't seem to list any uppercase names.
The tendency to prepend variables with % certainly comes from Guile or
more generally Scheme.  The upper case constants in Guile likely come
from C, where this convention is more popular and IIUC often concerns
integer constants, that are in some way important for the C side of
things (think of stuff like OPEN_READ).  Since that is not a concern
for Guix, a package manager mostly written in Guile Scheme, we can
prefix our constants with a percent sign.

Regards,
Leo



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

* Re: What's the meaning of the percent sign in variable names
  2021-04-23 14:49 ` Leo Prikler
@ 2021-04-24 13:29   ` Luis Felipe
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Felipe @ 2021-04-24 13:29 UTC (permalink / raw)
  To: Leo Prikler; +Cc: guix-devel

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, April 23, 2021 2:49 PM, Leo Prikler <leo.prikler@student.tugraz.at> wrote:

> Am Freitag, den 23.04.2021, 14:22 +0000 schrieb Luis Felipe:
>
> > Hi,
> > Are all these constants (%base-packages, for example)? Is this a Guix
> > convention or does it come from Guile? Although looking at Guile's
> > Variable index I see many constants in uppercase, and also some
> > variables prefixed with the percent sign, while Guix' Programming
> > index doesn't seem to list any uppercase names.
>
> The tendency to prepend variables with % certainly comes from Guile or
> more generally Scheme. The upper case constants in Guile likely come
> from C, where this convention is more popular and IIUC often concerns
> integer constants, that are in some way important for the C side of
> things (think of stuff like OPEN_READ). Since that is not a concern
> for Guix, a package manager mostly written in Guile Scheme, we can
> prefix our constants with a percent sign.

Thanks, Leo.


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

* Re: What's the meaning of the percent sign in variable names
  2021-04-23 14:22 What's the meaning of the percent sign in variable names Luis Felipe
  2021-04-23 14:49 ` Leo Prikler
@ 2021-05-04 15:49 ` Ludovic Courtès
  2021-05-05 14:18   ` Luis Felipe
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2021-05-04 15:49 UTC (permalink / raw)
  To: Luis Felipe; +Cc: guix-devel

Hi Luis!

Luis Felipe <luis.felipe.la@protonmail.com> skribis:

> Are all these constants (%base-packages, for example)? Is this a Guix
> convention or does it come from Guile?

To complement Leo’s answer…  The ‘%’ convention comes from Guile, which
may have borrowed it from other Schemes.  Initially, it was meant to
read as “sys” (“system”), as can be seen in libguile, meaning that a
percent-binding somehow belongs to “the system”: ‘%load-path’,
‘%make-void-port’, ‘%load-hook’, etc.

In Guix it’s used with an extending meaning, typically for variables
holding Guixy constants: ‘%base-packages’, ‘%setuid-programs’,
‘%desktop-services’, etc.  I hope it makes some sense!

Ludo’.


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

* Re: What's the meaning of the percent sign in variable names
  2021-05-04 15:49 ` Ludovic Courtès
@ 2021-05-05 14:18   ` Luis Felipe
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Felipe @ 2021-05-05 14:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hey Ludovic :)

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, May 4, 2021 3:49 PM, Ludovic Courtès <ludo@gnu.org> wrote:

> Hi Luis!
>
> Luis Felipe luis.felipe.la@protonmail.com skribis:
>
> > Are all these constants (%base-packages, for example)? Is this a Guix
> > convention or does it come from Guile?
>
> To complement Leo’s answer… The ‘%’ convention comes from Guile, which
> may have borrowed it from other Schemes.

I did find uses of the percent sign in other Scheme code (e.g. http://science.slc.edu/~jmarshall/metacat/)but enclosing the whole name. For instance (Metacat-1.2/Metacat/constants.ss):

;; Default window sizes
(define %default-trace-width% #f)
(define %default-trace-height% #f)
(define %virtual-trace-length% #f)


> Initially, it was meant to
> read as “sys” (“system”), as can be seen in libguile, meaning that a
> percent-binding somehow belongs to “the system”: ‘%load-path’,
> ‘%make-void-port’, ‘%load-hook’, etc.

Ah, I see.

> In Guix it’s used with an extending meaning, typically for variables
> holding Guixy constants: ‘%base-packages’, ‘%setuid-programs’,
> ‘%desktop-services’, etc. I hope it makes some sense!

It does. Thanks for the explanation.






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

end of thread, other threads:[~2021-05-05 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 14:22 What's the meaning of the percent sign in variable names Luis Felipe
2021-04-23 14:49 ` Leo Prikler
2021-04-24 13:29   ` Luis Felipe
2021-05-04 15:49 ` Ludovic Courtès
2021-05-05 14:18   ` Luis Felipe

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).