unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: Olivier Dion <olivier.dion@polymtl.ca>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: Guix records
Date: Wed, 10 Feb 2021 13:11:39 -0800	[thread overview]
Message-ID: <CA+XASoXoa1pV1-xEF3GGqfah7Z2mj+dJhjUqjOr27gBfWbc4ew@mail.gmail.com> (raw)
In-Reply-To: <875z30lqa7.fsf@clara>

On Tue, Feb 9, 2021 at 4:28 PM Olivier Dion <olivier.dion@polymtl.ca> wrote:

> On Tue, 09 Feb 2021, Aleix Conchillo Flaqué <aconchillo@gmail.com> wrote:
> > Hi Olivier,
> >
> > Unfortunately I don't have an answer, and actually I didn't even know
> this
> > existed, but I'd love to see a library for it. I added something similar
> > (in terms of syntax) to guile-json (define-json-type) and I'm happy to
> see
> > that it seems I was not doing something very stupid. For this specific
> > record it would be something like:
> >
> > (define-json-type <employee>
> >   (age)
> >   (name)
> >   (profession))
> >
> > Which will define a constructor and getters (no setters). However, to
> > create a new record you have to use the constructor (which is not very
> > convenient) or use an alist and then use (scm->employee). But it would be
> > great if one could do:
>
> Is (scm->employee) something (define-json-type) offers?  Just having
> that would be great.  I would be more tolerant to have guile-json as a
> dependency, since it's most likely lighter than Guix, probably already
> installed on the user system and it might me useful for users that are
> allergic to parentheses for configuration.
>
>
Yes, it is. Actually (scm->employee) is something that
(define-json-mapping) offers (also in guile-json). (define-json-mapping)
was originally copied from (guix json) which no longer exists in Guix, they
use guile-json instead.

Then (define-json-type) is based on (define-json-mapping), but yes all of
this is available in guile-json.


> >
> > It would be fantastic to combine (guix records) and guile-json somehow,
> but
> > I'm not sure how.
>
> If guile-json' license is compatible with Guix' license, I don't see any
> problem with taking the code from Guix and adapting it for guile-json.
>
>
Yes, they both are GPLv3. I was referring about how to actually do it
without breaking anything.
Aleix


  reply	other threads:[~2021-02-10 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 16:51 Guix records Olivier Dion via General Guile related discussions
2021-02-09 23:14 ` Taylan Kammer
2021-02-10  1:02   ` Dr. Arne Babenhauserheide
2021-02-10  5:37     ` Taylan Kammer
2021-02-10  8:38       ` Dr. Arne Babenhauserheide
2021-02-09 23:32 ` Aleix Conchillo Flaqué
2021-02-10  0:28   ` Olivier Dion via General Guile related discussions
2021-02-10 21:11     ` Aleix Conchillo Flaqué [this message]
2021-02-26 17:36 ` 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://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=CA+XASoXoa1pV1-xEF3GGqfah7Z2mj+dJhjUqjOr27gBfWbc4ew@mail.gmail.com \
    --to=aconchillo@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /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.
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).