From: Per Bothner <per@bothner.com>
To: Damien Mattei <damien.mattei@gmail.com>,
kawa mailing list <kawa@sourceware.org>
Subject: Re: macro definition in module
Date: Thu, 12 Oct 2023 14:33:14 -0700 [thread overview]
Message-ID: <14dbe843-4f61-a324-96d7-6e5bf9a53136@bothner.com> (raw)
In-Reply-To: <CADEOadcpzB3fG_0CDpM8psCbuAG25NEEsQ-JNyGtGGm4A1SM7Q@mail.gmail.com>
On 10/12/23 14:19, Damien Mattei via Kawa wrote:
> i know how to define a function in module,example
>
> ;; file ModuleName.scm
>
> (define-simple-class ModuleName ()
>
> ((string-null? str)
> (string=? str "")))
>
> but this syntax can help me to define a macro in module, is it possible?
Your example defines a method in a class (in a module).
Each module is compiled to a "module class" but when a module contains a simple class
with the same name, they are combined:
https://www.gnu.org/software/kawa/Module-classes.html#Same-class-for-module-and-defined-class
However, if you want to define a macro in a module, you have you have to use a separate
module class, because you can't define a macro in a simple class.
I suggest reading this thoroughly:
https://www.gnu.org/software/kawa/Module-classes.html
--
--Per Bothner
per@bothner.com http://per.bothner.com/
next prev parent reply other threads:[~2023-10-12 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 21:19 Damien Mattei
2023-10-12 21:33 ` Per Bothner [this message]
2023-10-12 21:41 ` Damien Mattei
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14dbe843-4f61-a324-96d7-6e5bf9a53136@bothner.com \
--to=per@bothner.com \
--cc=damien.mattei@gmail.com \
--cc=kawa@sourceware.org \
/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).