unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: Guile User <guile-user@gnu.org>
Subject: Re: Contracts macro example
Date: Thu, 4 Aug 2022 18:19:04 +0200	[thread overview]
Message-ID: <1c7afd30-1ec6-5edb-7835-cf4cc9f70c27@telenet.be> (raw)
In-Reply-To: <4e89ed41-dcbe-a7f5-f4b3-314e325016a5@posteo.de>


[-- Attachment #1.1.1: Type: text/plain, Size: 751 bytes --]

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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

      reply	other threads:[~2022-08-04 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 23:55 Contracts macro example Zelphir Kaltstahl
2022-07-19 15:20 ` Maxime Devos
2022-07-20  8:39   ` Zelphir Kaltstahl
2022-07-20  8:55     ` Maxime Devos
2022-07-24  1:21       ` Zelphir Kaltstahl
2022-08-04 16:19         ` Maxime Devos [this message]

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=1c7afd30-1ec6-5edb-7835-cf4cc9f70c27@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guile-user@gnu.org \
    --cc=zelphirkaltstahl@posteo.de \
    /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).