From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Olivier Dion via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Re: Guix records Date: Tue, 09 Feb 2021 19:28:32 -0500 Message-ID: <875z30lqa7.fsf@clara> References: <87lfc2e9vn.fsf@clara> Reply-To: Olivier Dion Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27681"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user To: Aleix Conchillo =?utf-8?Q?Flaqu=C3=A9?= Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Feb 10 01:37:38 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 1l9dVi-00077g-3H for guile-user@m.gmane-mx.org; Wed, 10 Feb 2021 01:37:38 +0100 Original-Received: from localhost ([::1]:60004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9dVh-0001oN-3s for guile-user@m.gmane-mx.org; Tue, 09 Feb 2021 19:37:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9dMa-0003MJ-LG for guile-user@gnu.org; Tue, 09 Feb 2021 19:28:12 -0500 Original-Received: from smtp.polymtl.ca ([132.207.4.11]:52409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9dMX-0007ks-ER for guile-user@gnu.org; Tue, 09 Feb 2021 19:28:11 -0500 Original-Received: from localhost ([89.36.78.216]) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 11A0RtBP003190 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Feb 2021 19:28:00 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 11A0RtBP003190 In-Reply-To: X-Poly-FromMTA: ([89.36.78.216]) at Wed, 10 Feb 2021 00:27:55 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:17235 Archived-At: On Tue, 09 Feb 2021, Aleix Conchillo Flaqu=C3=A9 wro= te: > 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: 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. > > (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, b= ut > 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. > > 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 >> >> --=20 Olivier Dion PolyMtl