From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SPRqA+7sm18YHgAA0tVLHw (envelope-from ) for ; Fri, 30 Oct 2020 10:37:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id OGC+Ou3sm18lLAAAB5/wlQ (envelope-from ) for ; Fri, 30 Oct 2020 10:37:33 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7280094042F for ; Fri, 30 Oct 2020 10:37:33 +0000 (UTC) Received: from localhost ([::1]:40740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYRml-0003R8-Er for larch@yhetil.org; Fri, 30 Oct 2020 06:37:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYReW-0002SW-9r for guix-devel@gnu.org; Fri, 30 Oct 2020 06:29:02 -0400 Received: from mout-p-103.mailbox.org ([2001:67c:2050::465:103]:41092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1kYReS-0001yf-Qh for guix-devel@gnu.org; Fri, 30 Oct 2020 06:28:59 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4CMz742jQjzQkJf for ; Fri, 30 Oct 2020 11:28:48 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brendan.scot; s=MBO0001; t=1604053728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WKMTvY3YBEkPgknUz1cAtM9rnx1CsrgqESfNFWc1vfA=; b=kQ300+5LnX6TunZiP6udpEydO7jLTsuxvT8mKJ+menN31xq3H2iO4ls/dCaJpkA2fOtApT ZUGK7OFBwUsFVA3uhLD4COT6drXRpHkPEwPJGXsXBUQ5genR11BN55O01LrfLnoWLSoeuy EAFeJSFZNB3ZfsGakQ5ntEK4ggF8q7pKlwdhhCSv7sDIsyGu3iIei+G0YIWGmc017RlkYl MqLA9NvXvGhloJYCfohM/G7TLZTRchVqg0zKGYQ5Jp5eZgdPwsKoyAvFLkQz7NwATnXlQO kBqRQtHy2Ad4gplzJyh0nnPKbAVrIoUGDlt5iSZlOH2WGgUezUd6VQSkQ+liww== Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id WPaYRWJ4pKMJ for ; Fri, 30 Oct 2020 11:28:45 +0100 (CET) From: Brendan Tildesley Subject: A better way to access records. To: guix-devel Message-ID: <487cea17-061a-2cc9-6b3e-7b688114d158@brendan.scot> Date: Fri, 30 Oct 2020 21:28:38 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-MBO-SPAM-Probability: X-Rspamd-Score: -1.53 / 15.00 / 15.00 X-Rspamd-Queue-Id: 45F77171A X-Rspamd-UID: 1a8fca Received-SPF: pass client-ip=2001:67c:2050::465:103; envelope-from=mail@brendan.scot; helo=mout-p-103.mailbox.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, 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: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=brendan.scot header.s=MBO0001 header.b=kQ300+5L; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: XJH4aXPMzjX3 From the little bit of SICP that I've done, I recall watching the lectures where they put a mage hat on and talk about the power of names. One could perhaps say the most powerful tool in a programming language is the ability to give something a name and then refer to those names. In guix/guile, record types are  list of names given to some data. For example: (define foo   (package    (name "bar")    (version "1.0")    ...) Here we the names foo, name, version, that refer to things of interest. We can call foo easily enough to get the record, but we cannot refer to name or version so easily.  We instead have to use accessors like (package-name foo), which requires us to write foo each time explicitly and have repeat package- for each accessor. In the guix codebase, on many occasions there appear things like this: (match-lambda     (($ agetty tty term baud-rate auto-login         login-program login-pause? eight-bits? no-reset? remote? flow-control?         host no-issue? init-string no-clear? local-line extract-baud?         skip-login? no-newline? login-options chroot hangup? keep-baud? timeout         detect-case? wait-cr? no-hints? no-hostname? long-hostname?         erase-characters kill-characters chdir delay nice extra-options)      (list       .... Here we have given some names to things, abandoned those names, and once again gone to the trouble of naming them again, in order, just for one local environment. We'd have to do it again to make use of it elsewhere, and I assume they would have to change if the record type it self needed to be updated. Wouldn't be nice if we could just step inside a record type whenever we pleased? The above would be like this perhaps: (let-from-record-type  (list ...)) "let-from-record-type" i just made up since i dont know what it should be called.  Anyhow, it seems like we're stepping back a few centuries in computer science by needing to jump through these hoops. The list of symbols can be retreived with (record-type-fields ), but I can't think of how one would write the above syntax. Opinions?