unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>
To: Mike Gran <spk121@yahoo.com>
Cc: guile-user@gnu.org
Subject: Re: Guile assert macro
Date: Mon, 22 Apr 2019 23:52:54 +0200	[thread overview]
Message-ID: <cc6af343-38a1-552a-c61e-f5872f768018@gmail.com> (raw)
In-Reply-To: <20190422193625.GA30071@spikycactus.attlocal.net>

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.
>
> ---



  reply	other threads:[~2019-04-22 21:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 18:57 Guile assert macro Zelphir Kaltstahl
2019-04-22 19:36 ` Mike Gran
2019-04-22 21:52   ` Zelphir Kaltstahl [this message]
2019-04-23  0:54 ` Mark H Weaver
2019-04-23 20:47   ` Zelphir Kaltstahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc6af343-38a1-552a-c61e-f5872f768018@gmail.com \
    --to=zelphirkaltstahl@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=spk121@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).