From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id pvx6DclhdmFu2gAAgWs5BA (envelope-from ) for ; Mon, 25 Oct 2021 09:50:33 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KGpWCMlhdmFfXQAAbx9fmQ (envelope-from ) for ; Mon, 25 Oct 2021 07:50: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 90B4031F9 for ; Mon, 25 Oct 2021 09:50:32 +0200 (CEST) Received: from localhost ([::1]:37310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meukZ-0007eg-HT for larch@yhetil.org; Mon, 25 Oct 2021 03:50:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meuk6-0007e1-Sc for bug-guix@gnu.org; Mon, 25 Oct 2021 03:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meuk6-0003UA-IW for bug-guix@gnu.org; Mon, 25 Oct 2021 03:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1meuk6-0004Uq-9j for bug-guix@gnu.org; Mon, 25 Oct 2021 03:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#51383: noobie way of incorrectly using (guix records) Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 25 Oct 2021 07:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51383 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Joshua Branson , 51383@debbugs.gnu.org Received: via spool by 51383-submit@debbugs.gnu.org id=B51383.163514814817219 (code B ref 51383); Mon, 25 Oct 2021 07:50:02 +0000 Received: (at 51383) by debbugs.gnu.org; 25 Oct 2021 07:49:08 +0000 Received: from localhost ([127.0.0.1]:41554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meujE-0004Te-64 for submit@debbugs.gnu.org; Mon, 25 Oct 2021 03:49:08 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:45603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meujC-0004T9-Fv for 51383@debbugs.gnu.org; Mon, 25 Oct 2021 03:49:07 -0400 Received: by mail-wm1-f54.google.com with SMTP id 71-20020a1c014a000000b0032cafd23b1dso4622526wmb.4 for <51383@debbugs.gnu.org>; Mon, 25 Oct 2021 00:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=+EUzU5V5RdW/XUQOoNz0Q8fEnHodWi6fEKwMH6peseQ=; b=b4tqikgEThxtlLtBF21+4GTvvhftyDO6rMBPRFV4+aS/mW2nS3pzJDWm1F85Q5HalG ffFX7GGImEODCkOezLvLo37n5GJ1UyobFqWTOs56ioSIlN4bVM/8Qm83ZhmbW8PFy+9N DzQLzhtQk5qz3W1+fNYTXC8fhu5lvVj260DNoYymYZ5thhQ1xa4EsU6vlyAtLn04Dz+q RQliwO+somf4+CfrsRaWwNqQi/dC8R9gqK18G5yFUGuQDftYRjvIvE1yuskB1hp3qT3v rNobuhzKPle38PF601frmRS4cCyYWofGB7RcUGB+B8ELicn6Jkoa1w5WrIDQSzD49SZM gEHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=+EUzU5V5RdW/XUQOoNz0Q8fEnHodWi6fEKwMH6peseQ=; b=Tcl9ITi+ktseCqK4GLaxxW5qGnLmIXH+PKjjJtd6rh6pgY+yedy/JaZNamHCTgNhCX MWTQ9zSVOJXmDYHq7tqDH3+T4w5u4WmcjQ2kQq5S9aLqiL73mgqArYKT0l/tNYyl7V+/ 2FlZjvSHZQ36kgB6QP5XKp82XCs+t9F+TMtzyYBKJqB+Ht7TSS/dPZr2q/L4X2mWnPT6 9WSrm7FENTV1UmnNlEo+INWjOcGl0kUWOfJxFNbjQw3h+Pw3KS/7qmpUHO2m4Hsnf4c5 ZgrViVFBbz787CRR940TWcCVl+qwSPlEg0vFlHsm3P0v8hWYw/f+zA3lJthxV5YRtCPe mBFg== X-Gm-Message-State: AOAM531I9BzDWN2jgSKD1LfostPG4IKEgFPCdr+VfkIrOzxTPcX1Wkur z1+r7niJCfkecQWNgJz4Xi69XzVkbIE= X-Google-Smtp-Source: ABdhPJwfuSLYXi4NBX0MHR8JOwJSks+XG8O4Z2Ql6RurkBVWNpTQyJkdJTfFw4+mD0wmpWHK3jjM2A== X-Received: by 2002:a05:600c:4f81:: with SMTP id n1mr47271222wmq.63.1635148140457; Mon, 25 Oct 2021 00:49:00 -0700 (PDT) Received: from lili ([88.126.110.68]) by smtp.gmail.com with ESMTPSA id w14sm5729560wmi.37.2021.10.25.00.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 00:48:59 -0700 (PDT) From: zimoun In-Reply-To: <87zgqxiq91.fsf@dismail.de> References: <87zgqxiq91.fsf@dismail.de> Date: Mon, 25 Oct 2021 09:48:53 +0200 Message-ID: <864k95a6je.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635148232; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+EUzU5V5RdW/XUQOoNz0Q8fEnHodWi6fEKwMH6peseQ=; b=uFwuqs8WSf+LsgV8y55lXA4h6r1M9Mq/awyBg8uMZCdTOePricab/p6GZkOdpMUJs1f9KE kpPs2sH5DNwd6nA7HMVAM9P1VAieXrj36qBeb19SVjKLMSeazjbznpOyhlNiltdI3tMtsi 1qlJhnHKpS8oE27oh+5mn51OeneqO5Zd2qI2BpqtcVMAd5iw1m+VlQWZGfRmYIwjgIN+f1 Q/9wLWdUGrlgV3ugtwXanl52uRIey2M06V6ojvHenRPuQNEoACQGoHiF/juStbi4EMsBWl MH/5oVr5XJ3J3XbaM7+jPe4+yTijNRGiADAlUfK/W+hz2x2p5dsYAcfh4hmUDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635148232; a=rsa-sha256; cv=none; b=iUfpBJFN4woO7H7Mq8sQ64n3t6ennX5+J6gWzH4aIAp/r9+ougRDOnNbX4dAqbBCe2eg9y ZZEDeSqJ5XXjMjHkPPsz/q/HF49hlcg9p+F5w2KDyyd0xxz9tOLBNgytybdWxwVRb1kDkd c9KIrgsZ00iydaEG44xex8LXg2nmhqSM4yjfSlvM1028YTpXHvwxHbFDSXOqE04IKDElR3 5cfjK6nDXON4ukHQtVl5B2lYS3GB6OdsXcS8T7gmGb1h/iGLEt+6rXprUZsrMVV4JJOvBo gWMzYgR8LITyDoIvzMjZ+8JhPcYG2rFyLHxZy0KhmHfkFCLL3sdfmDx/UGaFrw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=b4tqikgE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -1.73 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=b4tqikgE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 90B4031F9 X-Spam-Score: -1.73 X-Migadu-Scanner: scn1.migadu.com X-TUID: ARfosCf9rgkn Hi, On Mon, 25 Oct 2021 at 02:15, Joshua Branson via Bug reports for GNU Guix <= bug-guix@gnu.org> wrote: > So I made a pretty noobie-like mistake a few minutes ago. When one > tries to make a (record-configuration), he invariably create an > infinite number of records. The guile compiler eventually runs out > of memory and stops compiling. > > (use-modules (guix records)) > > (define-record-type* > record-configuration make-record-configuration > record-configuration? > (command record-configuration-command > ;; the error is here is on the next line > (default (record-configuration))))=20=20 > > (record-configuration) This is defined by creating recursively another instance. Thus, It is expected that it does not work, no? Reading the doc, 1. what do you want to achieve? 2. what does it appear to you buggy? Or what do you think the =E2=80=9Ccorrect=E2=80=9D behaviour should be? --8<---------------cut here---------------start------------->8--- (define-syntax define-record-type* (lambda (s) "Define the given record type such that an additional \"syntactic constructor\" is defined, which allows instances to be constructed with nam= ed field initializers, =C3=A0 la SRFI-35, as well as default values. An examp= le use may look like this: (define-record-type* thing make-thing thing? this-thing (name thing-name (default \"chbouib\")) (port thing-port (default (current-output-port)) (thunked)) (loc thing-location (innate) (default (current-source-location)))) This example defines a macro 'thing' that can be used to instantiate records of this type: (thing (name \"foo\") (port (current-error-port))) The value of 'name' or 'port' could as well be omitted, in which case the default value specified in the 'define-record-type*' form is used: (thing) The 'port' field is \"thunked\", meaning that calls like '(thing-port x)' w= ill actually compute the field's value in the current dynamic extent, which is useful when referring to fluids in a field's value. Furthermore, that thunk can access the record it belongs to via the 'this-thing' identifier. A field can also be marked as \"delayed\" instead of \"thunked\", in which case its value is effectively wrapped in a (delay =E2=80=A6) form. A field can also have an associated \"sanitizer\", which is a procedure that takes a user-supplied field value and returns a \"sanitized\" value for the field: (define-record-type* thing make-thing thing? this-thing (name thing-name (sanitize (lambda (value) (cond ((string? value) value) ((symbol? value) (symbol->string value)) (else (throw 'bad! value))))))) It is possible to copy an object 'x' created with 'thing' like this: (thing (inherit x) (name \"bar\")) This expression returns a new object equal to 'x' except for its 'name' field and its 'loc' field---the latter is marked as \"innate\", so it is not inherited." --8<---------------cut here---------------end--------------->8--- (Argh, I do not know how to read/display the docstring from the REPL, another annoying* story. :-)) > This is not possible with (srfi sfri-9) > > (use-modules (srfi srfi-9)) > > (define-record-type > (make-employee name age (make-employeee 5 5 5)) > employee? > (name employee-name) > (age employee-age set-employee-age!) > (salary employee-salary set-employee-salary!)) Well, =E2=80=99(guix records)=E2=80=99 allows to do more than =E2=80=99(srf= i srfi-9)=E2=80=99. Aside, I am not convinced that this latter snippet is similar than the former previous one. Cheers, simon *annoying REPL, I get: --8<---------------cut here---------------start------------->8--- scheme@(guix-user)> ,describe define-record-type* While executing meta-command: Syntax error: unknown file:79:10: source expression failed to match any pattern in form d= efine-record-type* --8<---------------cut here---------------end--------------->8---