guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parameterized packages


From: Pierre Neidhardt
Subject: Re: Parameterized packages
Date: Tue, 21 Jan 2020 11:09:25 +0100

ison <address@hidden> writes:

> Just a thought, but could this be achieved using Guile's parameterization
> feature?
> https://www.gnu.org/software/guile/manual/html_node/Parameters.html
>
> Not sure which method will be best overall, but its something to consider
> and might avoid the need to define a bunch of extra functions. So basically
> all standard parameters could be defined globally using make-parameter, then
> in the parameters field of the package it lists the parameters they want
> which will pick up the default values, or be overridden by parameterization.
>
> Although I wonder if maybe it's better to not use global defaults for the
> parameters and just let packages set their own defaults?

Actually I don't know.  An important feature of package parameters / USE
flags is typing.  But Guile does not have much support for typing as far
as know.  So if we need to implement some sort of typing in Guile, what
we could do is create a Guile record with the following fields:

- value
- predicate

The value should not be accessible directly, instead we need some
function that will reference the value by first applying the predicate
on it and throw an error if it returns #f.  This way we can enforce some
run-time typing.  Not ideal but that could work.  Any better option?

Typed/Racket would be great here :)

Otherwise, we can ditch the typing and use Guile parameters as you suggested.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]