unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: jbranso@dismail.de, Bruno Victal <mirai@makinata.eu>,
	guix-devel <guix-devel@gnu.org>
Cc: "Felix Lechner" <felix.lechner@lease-up.com>,
	"Maxim Cournoyer" <maxim.cournoyer@gmail.com>,
	"Ludovic Courtès" <ludo@gnu.org>
Subject: Re: Brainstorming ideas for define-configuration
Date: Fri, 10 Mar 2023 23:37:17 +0100	[thread overview]
Message-ID: <c002fb314afa9cb9563a35a8967fce33fa41aedf.camel@gmail.com> (raw)
In-Reply-To: <564d5fb289ca2f547ba89fa8f39b7b72@dismail.de>

Am Freitag, dem 10.03.2023 um 20:15 +0000 schrieb jbranso@dismail.de:
> While I would agree that a guix service writer should avoid mutually
> exclusive fieldnames and instead prefer mutually exclusive records
> (and 95% of that time that will work), but may we examine it from a
> user's perspective? How does the service writer differentiate from
> a string title or string name?
> 
> Suppose that you want to respond to a king's rudeness. You can
> secretly insult him or obviously insult him:
> 
> ===Mutually exclusive records===, which are better from a
> maintainer's perspective, but perhaps cause the user to write more
> scheme:
> 
> "..your traitor brother. Maybe I’ll feed him to wolves after I’ve
> caught him. Did I tell you, I intend to challenge him to single
> combat?"
> 
> (insult-configuration
>   (response
>     (secret-insult-configuration
>       (secret-insult “I should like to see that, Your Grace.”))))
> 
> OR
> 
> "You can't insult me."
> 
> (insult-configuration
>   (response
>     (obvious-insult-configuration
>       (obvious-insult "We've had vicious kings and we've had idiot
> kings, but I don't know if we've ever been cursed with a vicious
> idiot for a king!"))))
> 
> ===Mutually exclusive fieldnames===
> 
> "I am the KING!"
> 
> (insult-configuration
>   (secret-insult "Any man who must say, 'I am the king' is no
> true king. I'll show you that after I've won your war.")))
> 
> OR
> 
> "You are Kingsguard!"
> 
> (insult-configuration
>   (obvious-insult "...F*ck the King."))))
> 
> These examples are pretty wonky I will admit, but I really like
> an option of having mutually exclusive fieldnames.  Having said all
> of this, I will agree that that mutually exclusive fieldnames are a
> bit like "goto" in C.  You really should never use them, unless you
> absolutely have to.
These insult configurations are a little crafted in that the insult-
configuration does not have enough fields to make the necessity of a
nested field obvious.  That is, you could just as easily write
  (insult-configuration
    (tone 'obvious)
    (insult "F*ck the King."))
and look at this record as a "single" value.

Note that neither serialization depends on the other.  For instance,
you can serialize this to XML as 
  <insult tone="obvious">F*ck the King.</insult>
where both fields just need to have their special characters escaped
and the serializer for insult-configuration stitch them together via
format strings.  Obviously, going through SXML would be better, but
it's possible.

Now, if you wanted to add more metadata, like the location at which
you've insulted the king and the time of day, none of which are of
interest for the content of your file, but perhaps of interest the
medium by which you choose to insult him, it would be better to keep
those concerns separate rather than merge them into a single record.

Cheers


  reply	other threads:[~2023-03-10 22:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  2:28 Brainstorming ideas for define-configuration Bruno Victal
2023-03-09  8:13 ` Attila Lendvai
2023-03-09 21:05   ` Josselin Poiret
2023-03-09 14:40 ` Joshua Branson
2023-03-09 20:23 ` Liliana Marie Prikler
2023-03-10 14:10 ` Maxim Cournoyer
2023-03-10 20:15 ` jbranso
2023-03-10 22:37   ` Liliana Marie Prikler [this message]
2023-03-15 16:27 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c002fb314afa9cb9563a35a8967fce33fa41aedf.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=felix.lechner@lease-up.com \
    --cc=guix-devel@gnu.org \
    --cc=jbranso@dismail.de \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    --cc=mirai@makinata.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).