From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Taylan Kammer Newsgroups: gmane.lisp.guile.user Subject: Re: Guix records Date: Wed, 10 Feb 2021 06:37:32 +0100 Message-ID: <2c723161-6be9-26e0-dfc0-14e43cdda6fc@gmail.com> References: <87lfc2e9vn.fsf@clara> <87o8gs68gw.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14632"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 Cc: guile-user@gnu.org To: "Dr. Arne Babenhauserheide" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Feb 10 06:37:51 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 1l9iCE-0003iW-Vc for guile-user@m.gmane-mx.org; Wed, 10 Feb 2021 06:37:50 +0100 Original-Received: from localhost ([::1]:51278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9iCE-0002U0-1b for guile-user@m.gmane-mx.org; Wed, 10 Feb 2021 00:37:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9iC2-0002Tr-Je for guile-user@gnu.org; Wed, 10 Feb 2021 00:37:38 -0500 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:34921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9iC0-0001hR-UU for guile-user@gnu.org; Wed, 10 Feb 2021 00:37:38 -0500 Original-Received: by mail-ej1-x635.google.com with SMTP id a9so1795403ejr.2 for ; Tue, 09 Feb 2021 21:37:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HK4atVsIIwmpAXY5T71lh4VcqzkRDD5e7t4Nv6ZafXk=; b=XHZSlfMEVCuWBrDvZxCKL923A2frRQzkeV66scirvIseBqUX5JXsXcR1rVaTtCOkEZ bD5jLLl2s+K5iW3ZIOgq5J56hlrTztCBNRqBk9x9j+dnfz05qCTT1NHEhRJQ/Lb4ruEF G3fx0k8PkHVuh+O+NYGcHffM6jbg+s9Tnh+D/q+5ueOgW1j65jziWd2F89v7HYV3giAL u3D5etfxDHCdiLOX1jbzpEhLdGh5/QSr4FmdzcSRULf+Xcr8VK3Eh4B5pS1cAm7egEX0 84Uo8VaGO7CHBZwwcxSV1/Zh+cT+t02mWifIQAmPkO34DY9oPwEBkVowKnKagiEVLfiW nA2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HK4atVsIIwmpAXY5T71lh4VcqzkRDD5e7t4Nv6ZafXk=; b=BT1K2uQ0qr1WWU6X7EOCqbP9IjMenc0rGqxxjsYC+D9wFRv7j5P5Ysfbb4q46s5udL NDCrTQRJargFh9IYBClc6/BdYqhIfhSouU3RVKz50tsf4FZqkaUBnRdRSKDvRM1z1NSz 0hOggW+qSmE/7kP0W5jfW5uzto8AdxvINP30NCjjx9iAlG3y1XqP74HEqSSQ/RdNv6RK E3Ni+jPNHgztqkHVLGLnkM03pJYJEUB+5np90qcJARJsTINCZX5is235wRT8XSBiNeAY JlsASis7etB1odKDvz182a8jGc+YU0JyspiyyWTiOQ81wTPHACA2Hf+58a2vHJtnKXEq 9Kxw== X-Gm-Message-State: AOAM530/WrYeAScEHbqruy7YLK8jwjgvXaA81Wqk5jV5EtrdGv98nD34 qtYVOMSbajYjl6iUwhmPjrxtmKWBpl0= X-Google-Smtp-Source: ABdhPJxT+UbW3lt2m9nEaurUUs27E9EHdCaW6CxMgoNt49iOpBULeQ32GgUmPmkiJlzt0eoTQ5++pg== X-Received: by 2002:a17:906:af58:: with SMTP id ly24mr1324415ejb.208.1612935455369; Tue, 09 Feb 2021 21:37:35 -0800 (PST) Original-Received: from [192.168.178.20] ([109.90.125.150]) by smtp.gmail.com with ESMTPSA id jg33sm424641ejc.103.2021.02.09.21.37.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Feb 2021 21:37:34 -0800 (PST) In-Reply-To: <87o8gs68gw.fsf@web.de> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=taylan.kammer@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 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, NICE_REPLY_A=-0.265, 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-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:17237 Archived-At: On 10.02.2021 02:02, Dr. Arne Babenhauserheide wrote: > > Taylan Kammer writes: >> The most feature-rich record system supported by Guile is probably the >> R6RS record system, which is available through the modules: >> >> (rnrs records syntactic (6)) >> (rnrs records procedural (6)) >> (rnrs records inspection (6)) >> Here's a super brief example usage of R6RS records, demonstrating that >> field accessors are defined implicitly, but constructors still use an >> unnamed sequence of arguments to assign fields: >> >> (import (rnrs records syntactic (6))) ; must use 'import' for R6RS >> >> (define-record-type (cat make-cat cat?) (fields name age color)) >> >> (define garfield (make-cat "Garfield" 42 'orange)) >> >> (cat-color garfield) ;=> orange > > I did not know about that shorthand — thank you! > > I always did this: > > (import (srfi srfi-9)) ; define-record-type > (define-record-type > (make-cat name age color) > cat? > (name cat-name) (age cat-age) (color cat-color)) > > Compared to that the syntactic form you showed is much nicer. I actually prefer the conceptual simplicity and explicit nature of SRFI-9 to be honest, but yeah, it can be very verbose. > Is there a difference in efficiency or such? Theoretically there shouldn't be, since the implicit defining of the accessors happens at compile time. However, pre Guile 3.0, the R6RS record system was implemented completely independently from the SRFI-9 implementation, so the two could have various differences in performance. According to the 3.0 release notes, R6RS and SRFI-9 now both use a unified core record system under the hood and should therefore have equivalent performance characteristics I suppose. > Best wishes, > Arne > - Taylan