guile-user
[Top][All Lists]
Advanced

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

Re: Contracts macro example


From: Maxime Devos
Subject: Re: Contracts macro example
Date: Thu, 4 Aug 2022 18:19:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 24-07-2022 03:21, Zelphir Kaltstahl wrote:

~~~~
(define-syntax require
   (identifier-syntax
    (syntax-error "'require' can only be used as part of a contract 
construct")))
~~~~

Can you explain how it works?

If you meant: how can identifier-syntax + syntax-error be used? -- I don't have more information than the explanations in the manual on identifier-syntax and syntax-error.

If you meant: how does it work?  I don't know how Guile's macro system is implemented, you'll have to look at the source code of (ice-9 psyntax), maybe read the paper it cites.

If you meant: how to use it? All you have to do is replace your (define require ...) by the (define-syntax require ...)

Greetings,
Maxime

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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