guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile assert macro


From: Zelphir Kaltstahl
Subject: Re: Guile assert macro
Date: Mon, 22 Apr 2019 23:52:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]