From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qNfsBu9WR2InWwAAgWs5BA (envelope-from ) for ; Fri, 01 Apr 2022 21:47:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iFOKA+9WR2KeggAAauVa8A (envelope-from ) for ; Fri, 01 Apr 2022 21:47:59 +0200 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 B25A8405E9 for ; Fri, 1 Apr 2022 21:47:58 +0200 (CEST) Received: from localhost ([::1]:58324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naNFV-00035p-UU for larch@yhetil.org; Fri, 01 Apr 2022 15:47:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naNF1-000347-PX for guix-devel@gnu.org; Fri, 01 Apr 2022 15:47:28 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:41661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naNEz-0006zv-JC; Fri, 01 Apr 2022 15:47:27 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 1F5402B003C6; Fri, 1 Apr 2022 15:47:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 01 Apr 2022 15:47:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; bh=qTJZH2B+CPL8h6ZGBMZ7hR56m4nEHde7ndl4u0 udFk0=; b=ns2QvAA6LZbkDZa0TuUIrHg74zb2m68ZpcJqhCtR8Eu7OwsRVrtdq7 bXOgN4hYkJYA8nSQP2Ziq9h7778whIclID0Rx5Shjwj5xyMbf2qjSipoR7Hq7BMO 6IrwvA/ZA/rFQ3DiRYKm2dNwjsE0S3iPnQ52aHComnNYEE8DaxMFwwl3FTv28ejI mU4zEOttn/dsEpqFSWpfnaZYxzOmYi3AaNfsbMclYld/qWO+qm4JLcb92QcebLpa XB8yrmNzP2aQLLXs8+SggRIFc3fWgrDcnxPLIVHunjKJaFAhcyjhBDAXI3WdPhv4 uVy8bAkaWOP3YIgSeS1nHinzHtNXCYUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=qTJZH2B+CPL8h6ZGBMZ7hR56m4nEHde7ndl4u0udF k0=; b=OunBv8zWOOouHrFfcXMPjAFTr1wq1k7cKy9biTdRtvMGs7puVccL/1nT5 y1mGePMoX8tpOWdL8OWCiM70D5g6dUbEbwckvXEJIjdWMr95DlRlVXsfA334UBnY ccqln8K7PTFXTBEWO/hvUmFjNO09rPHjTInf9fUlIs+W1FVKruZYrwJRrfUgOzuX sGBxbGRQ6sKtv4RtnWMr8ZXOsvDt/7rPciyqMd1OKTiYv6IcnbE7rLc6Ehpeu4RH SFw2CWG65/NDhdAybQdespu9xR+uybvr/40nR/f9kUAsU6R1eICsk6+UNuTan66g b9FNdyJEN3cE9CfKiqDg4PabnWRbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeiiedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpefrhhhi lhhiphcuofgtifhrrghthhcuoehphhhilhhiphesphhhihhlihhpmhgtghhrrghthhdrtg homheqnecuggftrfgrthhtvghrnhepgfehteekteehkeetheevudfgheeltdetieeuffei uefhgeefiedttdejgfekueevnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhhihhlihhpsehphhhi lhhiphhmtghgrhgrthhhrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Apr 2022 15:47:19 -0400 (EDT) Message-ID: <422d68e3-4ed9-1ea5-88d5-51763a8f4420@philipmcgrath.com> Date: Fri, 1 Apr 2022 15:47:18 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: better error messages through assertions Content-Language: en-US To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= References: <87ilthoxvu.fsf@elephly.net> <87k0dv6ahq.fsf@elephly.net> <87mtibdu5l.fsf@gnu.org> <2205364.8dmU9V6fpu@bastet> <87cziy2hq0.fsf@gnu.org> <87lewrwzll.fsf@gnu.org> From: Philip McGrath In-Reply-To: <87lewrwzll.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=64.147.123.18; envelope-from=philip@philipmcgrath.com; helo=wnew4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Wurmus , guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648842478; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=qTJZH2B+CPL8h6ZGBMZ7hR56m4nEHde7ndl4u0udFk0=; b=r6OWC8H8cY5PWTKzvp378Kpd4ORxYGVgRHf/DlC9FGJCxWMIWEkExWa2bZsrc+HxdrFvjU o349ZE4viFp9WgAsUbClaIYWvFpEf/0BUc4qxJn9xJK5IgDMYTUhZUXZeIHRXAxID5HVpb 79n68Z1U5vsTZ8HtDaEvDSvubNbFLyp6oKtJfC3ett9lpCyX94m7pzTFI7+JREWOXvHnJT 81Fjr7KBIycDGkCiSq3LnRM8MYVXAB1T02U6OUcv6e6lepHWkzgHlSzMjTf5SAt8WusVSG JWkgbtsyqiQagdCi/ARuvENSBuRw5URWaF6GZMBJQVO0lc12wVTFUa4ouK/yoA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648842478; a=rsa-sha256; cv=none; b=MFAqUKQwYoQ736xDW9SKEJXBqQSEKVct132zO9ySII22VKLgjLa8hsr3LiOlFz8emdlwBh wR3oDej5jbQxuiRPp+K8J1OITEQ+i/fihG8Iys/dPyfkSVjWTClUCQqUSAa2zb/4vMTZGA XK67eV9HHNFQERUPSseYGgC9e5kgKiO/m4nI1ln66eVx+ON0lJu+q8+hMi1toeDiCdG4s3 gs41KxZsnQPUIVDK/+6+6NJA+D+biEoyAeSzYCBhKWNwr0DLk07NUusqwcTNDQbFQOmcp0 qECwlIO+Zd8qYDnNKCXEfluRIzyVgmjyrNDcA1MV+OgIpwiZjI876DJjhe6IDw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm1 header.b=ns2QvAA6; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=OunBv8zW; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=fm1 header.b=ns2QvAA6; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm3 header.b=OunBv8zW; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B25A8405E9 X-Spam-Score: 1.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: Qbv+M06C20ho Hi, On 3/30/22 05:37, Ludovic Courtès wrote: > >> What is the preferred mechanism for exceptions? > > For Guix code, SRFI-34/35. > >> Likewise, what record system should I use? > > SRFI-9. > > (Perhaps we should put answers to these questions in the “Coding Style” > section of the manual.) > As I've looked more closely, I think I'd be porting a fair amount of code that looks like this: ``` (define-struct (blame-no-swap blame) () #:property prop:equal+hash (list blame=? blame-hash blame-secondary-hash)) ``` That code creates a new opaque struct type `blame-no-swap` with parent type `blame` and customizes the behavior of `equal?` and `equal?`-based hashing (but the customization only applies when the two potentially-equal values are both immediate instances of `blame-no-swap`, not a supertype or subtype). It looks like SRFI 9 doesn't have a notion of opaque or parent types, so it seems like it would be easier to use R6RS records as the basis for porting. (I think it should still work to use SRFI 9 records for the interface. But I know the representation of blame, among other details, has gotten a lot of attention over the years, so it seems like it would be good to keep the port as close as reasonably possible to the Racket implementation.) I'm less sure about `equal?` and hashing. I see in [1] that `equal?` can be controlled via GOOPS, and I have the impression that there's some kind of bridging between basic types and GOOPS, but I'm not clear on the details. I don't see anything explicitly about customizing `hash`[2], but maybe that would work the same way? -Philip [1]: https://www.gnu.org/software/guile/manual/html_node/GOOPS-Object-Miscellany.html [2]: https://www.gnu.org/software/guile/manual/html_node/Hash-Table-Reference.html#index-hash