From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.user Subject: Re: Contracts macro example Date: Tue, 19 Jul 2022 17:20:03 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21194"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.42.1 To: Zelphir Kaltstahl , Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Jul 19 17:20:29 2022 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 1oDp1Q-0005E2-V1 for guile-user@m.gmane-mx.org; Tue, 19 Jul 2022 17:20:28 +0200 Original-Received: from localhost ([::1]:55222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDp1P-0006t1-W8 for guile-user@m.gmane-mx.org; Tue, 19 Jul 2022 11:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDp19-0006sA-Jl for guile-user@gnu.org; Tue, 19 Jul 2022 11:20:11 -0400 Original-Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]:44466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDp17-0000xm-Hd for guile-user@gnu.org; Tue, 19 Jul 2022 11:20:11 -0400 Original-Received: from ptr-bvsjgyig5nh0salm0pi.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:5dba:d409:33f7:a16]) by baptiste.telenet-ops.be with bizsmtp id x3L42700A20ykKC013L4Ko; Tue, 19 Jul 2022 17:20:05 +0200 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1658244005; bh=UuQ58WUm9k1o+CUQatSDLklw2KFhJ9+eilb7z2j8t+M=; h=Subject:From:To:Date:In-Reply-To:References; b=hLjD4HZi2mPpxu4KgXtrR8Sy8WfPopforT/heUeK0inWFioSf/gsUWDACLhIbIU/p foKutImImzF+SN9luqCzbxeVlnc4w+37W55JwdmDjUhgJbxMlswbPpa8wgCFV/r/I+ l+ata4IMZFoHmwx4qh5NlL4Pa/PpDICsyZ1j5S6xEls3wOrLAwxlXeU+/bQr/e7nvH QOToD5nXkxVqadoopxeb7+i9fcxnobki6BHpDnanhE0Cs8c0jBMoyFjK+Q0pS7CHD4 joXTAmNTLKRD+L/L15nmiZOSG2oACf+wUUxajgQfnpjL7WJDd4VOJvu9RR8GvvST03 qKEw3WQa1CydQ== Received-SPF: pass client-ip=2a02:1800:120:4::f00:13; envelope-from=maximedevos@telenet.be; helo=baptiste.telenet-ops.be 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=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: guile-user@gnu.org X-Mailman-Version: 2.1.29 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:18433 Archived-At: Zelphir Kaltstahl schreef op do 14-07-2022 om 23:55 [+0000]: >           (make-assertion-failure) >           (make-exception-with-message "assertion failed") >           (make-exception-with-irritants (quote (op args* ...)))))] Instead of a generic 'assertion failure', I believe a more specific &contract-failure to be better. Also, define*-with-contract / lambda*-with-contract would be nice. It would also be nice to define a global 'require' and 'ensure' and '' somewhere (e.g.: (define-syntax require (identifier-syntax (syntax-error "'require' can only be used as part of a contract construct")))), that way, require / ensure / can be renamed during importing, so all contract things could be prefixed with, say, contract:. ;; `#t`, the neutral element of `and`. Guile supports Unicode and UTF-8, so you can write ‘#t’ here instead of `#t`. Additionally, maybe #t -> #true? Greetings, Maxime.