From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: Guile assert macro Date: Mon, 22 Apr 2019 23:52:54 +0200 Message-ID: References: <5017489f-1e55-a3db-07c9-c1158c3160f8@gmail.com> <20190422193625.GA30071@spikycactus.attlocal.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="70903"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: guile-user@gnu.org To: Mike Gran Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Apr 23 00:03:43 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIh2M-000IHl-NB for guile-user@m.gmane.org; Tue, 23 Apr 2019 00:03:42 +0200 Original-Received: from localhost ([127.0.0.1]:44832 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIh2L-000876-JR for guile-user@m.gmane.org; Mon, 22 Apr 2019 18:03:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIh1X-0007z7-8D for guile-user@gnu.org; Mon, 22 Apr 2019 18:02:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIgry-0007mm-MY for guile-user@gnu.org; Mon, 22 Apr 2019 17:52:59 -0400 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:45191) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIgry-0007mG-Em for guile-user@gnu.org; Mon, 22 Apr 2019 17:52:58 -0400 Original-Received: by mail-lf1-x12b.google.com with SMTP id t11so10048283lfl.12 for ; Mon, 22 Apr 2019 14:52:58 -0700 (PDT) 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-transfer-encoding:content-language; bh=HtQA9ymKSoFH/AgKpmsykUIoTV6ZCoejXuX1qU5ht6U=; b=HWD1OJ1J9M9i7dZLSgUIIKApE2JTW5sNQwP40Aew2bcY301xfUAvw+aatuoZOvXKKK 37wUFxW4rOespgcOUwgWt4GG71BwnEf9pxTB73qjlFUZ80mBS/e7+PficmU8eFODcNeH dFMdW1usCdA203H0njOT+oneEY6gznom8KsaFgaS46i7d77P+xtQm+7333FpbthgPS9I fk0DAGeaLqYp7eu//gAuNr2si3Ih3g3iUkmh00vQraEr0XQ1eHVwmpGNQOIiPLto+YJy ruAQYNU9G8FXsre+w5TsFkMC0XKrsoWxQGq96kI7tA9S4nZIJwsDSng9ANWgErrCS4xl J+Jw== 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-transfer-encoding :content-language; bh=HtQA9ymKSoFH/AgKpmsykUIoTV6ZCoejXuX1qU5ht6U=; b=uUifAHyfirvR1cc6VlIq/PGMxU0pOH44Bgh+x7pd+grAs4uATxcHDKUn0awO8RESGx PMTPPXQ6segI8z0H3usL9tGJmgHEzg4qL/NgX2RAlIgTXSCOEEpEMUDTlyydHpOmfxvh xhU/QxxWfFvubAGbweI/TL4dfSrh/DhlawYvVi7y/lY2MCugqxiIAaAMqG5fC08y9VcB TB/gLsQaWgoVpXjEu7sO7WwWPUbnYP7axlTZF9ETzTUfYWgToHh2eSPr5jxDwUWpBXPG +U0N9M3E4JZO7WNZglsea1Pyk6ya3nDzsreDEzDsglC8ycqabBIT4BAC6hqQY+SqIe1q e4rA== X-Gm-Message-State: APjAAAWOa1cJRi9M8X8Hfa9v6GlUotDIqpO3qx/Ey2CRZSLQ6zCfyv8N NTXB9Edd0bBm+3LZMbqLTq78U5PKjp4= X-Google-Smtp-Source: APXvYqwQYE+rMkDmFR8IFSxghEUUNspTJPNdp6SUAf7qKI7QznTOaTGKULjJFgN3LnnyEE683RcQ4w== X-Received: by 2002:a19:f013:: with SMTP id p19mr11246491lfc.49.1555969976493; Mon, 22 Apr 2019 14:52:56 -0700 (PDT) Original-Received: from [10.10.0.17] ([185.213.154.165]) by smtp.googlemail.com with ESMTPSA id v4sm2940730ljv.4.2019.04.22.14.52.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 14:52:55 -0700 (PDT) In-Reply-To: <20190422193625.GA30071@spikycactus.attlocal.net> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12b X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15413 Archived-At: Hi Mike, Thank you for sharing your assert version. I am more focused on finding out, whether the assert macro from  Oleg Kiselyov's page is already in Guile somewhere (and thus in the standard and usable without installing libs or putting more code unrelated to other stuff inside an example project) and if not, why not. However, I guess your point is, that there are many implementations of some kind of assertion facility? If I see it correctly in the code you wrote, the type test assertion simply puts a question mark at the end of the type argument to the ~assert-type~ macro. I have a few questions about this: Q1: What happens, if there is no such predicate with a question mark at the end? Q2: Why not write the type assertion in terms of basic assert macro you wrote, instead of using another ~syntax-case~? Q3: Does such a type assertion make sense as a separate facility, compared to simply using ~(assert (number? x))~ for example? (Note, that I am not very experienced in macro writing myself. It is still something I need to get an intuition for. In the case of assert, it seems to me, that it is a natural case, where a macro would make sense. Finding Oleg Kiselyov's page going on about the assert macro seems to confirm this with at least an "authority argument".) Regards, Zelphir On 4/22/19 9:36 PM, Mike Gran wrote: > On Mon, Apr 22, 2019 at 08:57:32PM +0200, Zelphir Kaltstahl wrote: >> Hello Guile users, >> >> I was looking for an assert facility in Guile and found the following: >> >> https://www.gnu.org/software/guile/manual/html_node/rnrs-base.html#rnrs-base >> >> (Search for assert there to find it on the page.) >> >> However, while searching, I also found something that looks even better: >> >> http://okmij.org/ftp/Scheme/assert-syntax-rule.txt > This is my assert macro. I'm sure there are dozens of other versions. > > ---