From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.user Subject: Re: Guix records Date: Tue, 9 Feb 2021 15:32:44 -0800 Message-ID: References: <87lfc2e9vn.fsf@clara> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25736"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Olivier Dion Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Feb 10 00:33:10 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9cVJ-0006bi-Fp for guile-user@m.gmane-mx.org; Wed, 10 Feb 2021 00:33:09 +0100 Original-Received: from localhost ([::1]:35500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9cVI-0005tQ-AJ for guile-user@m.gmane-mx.org; Tue, 09 Feb 2021 18:33:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9cV8-0005tI-NO for guile-user@gnu.org; Tue, 09 Feb 2021 18:32:58 -0500 Original-Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:33198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9cV7-0003jI-2m for guile-user@gnu.org; Tue, 09 Feb 2021 18:32:58 -0500 Original-Received: by mail-pg1-x534.google.com with SMTP id e7so13326pge.0 for ; Tue, 09 Feb 2021 15:32:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PcIiacGpHSD1eBEivBjkw0Dr3Y5i7+EAAmQutyYOyqo=; b=QyFEEzQllpn0Rjj2QvqXMfQlgXDKtuHjiweHcLKicIwKxxPJ/LaX9EI3Yr1Rrk23fg cnFCHVZPaWvoCzzJp4D5PHGaybQqB1qwQ80eHm3RI1mMHvsr6joXCU6/cwiSOAMx4YPC 3hvs8mmoCuHWAurKPhq38fA1v7+9WUrXzjddMJBhogLohgH395phPzaBt2tbxP7mu+vo ak1vuLmj2swX7Cd88tg0imNnI9hAocYhNDaOppkBlL1hv/YXVE0YgI3rEi+R+CPxZD96 DEIce7ORgpSYIjZMdfku+k0Wqw/YCDTdp3QvxMV167VkeRGhrzmRj1j1YwZOUhO58gcD 5CyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PcIiacGpHSD1eBEivBjkw0Dr3Y5i7+EAAmQutyYOyqo=; b=OOmTRojqaO7vgc6ewXYpg94XxOYcAxAIYI4WG9hPHJqX6C2t50tqVcnrp2JaLnlX7o eHa7RvgPL3STvNI5mb86SN4InBsehMqWENjwChDjMqCAKwLOCKgAmTrpSDlFWNc/PtW5 cBBQcNZ+DereGAeE4zt3hPneS5ZJ9y5zOQ1fFSkXzKIiaKiuIpq6LDU1wfdsJO+3n8dw xYZxz3HRGf+bVc2Dg5PiOkJ/mpwEt0FSivoxBdXSdiP5HLNGwZ7Krs0BDZ9Xoic4oyx/ lR1B5ybzybN4a/2qp29BrmZ82794Yta+8fgqPTlrsyI/Gvyv0sCy8XhGVJqUtxUclJLQ 9jKA== X-Gm-Message-State: AOAM533MTc3TBF2ALcgxdRDNWAuGlVjjpkz8fMDKDtiGQEWZtR+sqWci c1X7x4ayziEqBIy6Z4KS5+W6vcnf0/QmD1PnuOo= X-Google-Smtp-Source: ABdhPJy3NdLqpeJ/iXkNueKVPbLaOjJMSf7z4icgsO1lDcXrnO7Ktgh4Oncbk4BFW4IPc99V1Hbfq5/DCfcn52bnbQc= X-Received: by 2002:aa7:9f1a:0:b029:1de:2c09:a040 with SMTP id g26-20020aa79f1a0000b02901de2c09a040mr477995pfr.21.1612913574956; Tue, 09 Feb 2021 15:32:54 -0800 (PST) In-Reply-To: <87lfc2e9vn.fsf@clara> Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=aconchillo@gmail.com; helo=mail-pg1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17234 Archived-At: 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 (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: (employee->json (employee (age 30) (name "Foo") (profession "Teacher"))) instead of: (employee->json (scm->employee '((age . 30) (name . "Foo") (profession . "Teacher")))) It would be fantastic to combine (guix records) and guile-json somehow, but I'm not sure how. Sorry I couldn't provide any useful insight. Best, Aleix On Fri, Feb 5, 2021 at 9:24 AM Olivier Dion via General Guile related discussions wrote: > Hello, > > In the module (guix records), there's some very nice syntax rule > `define-record-type*` that allows very powerfull declarative style of > records. For example: > ---------------------------------------------------------------------- > (employee > (age 30) > (name "Foo") > (profession "Teacher")) > ---------------------------------------------------------------------- > > I would like to use this feature in my software. However, I don't want > to have Guix as a dependency only for that. For now, I've copied the > content of (guix records) into (my-software records). But this put > burden of maitenance into my hands. > > Thus, I'm looking for an alternative, perhaps there's a Guile library > (other than Guix' module) or a SRFI that offers similar feature? > > -- > Olivier Dion > PolyMtl > >