From: KAction@gnu.org
To: guile-devel@gnu.org
Cc: wingo@pobox.com, ludo@gnu.org, Dmitry Bogatov <KAction@gnu.org>
Subject: [PATCH] Replace define-macro with syntax-rules
Date: Sat, 28 Sep 2013 09:25:55 +0400 [thread overview]
Message-ID: <1380345956-1720-1-git-send-email-KAction@gnu.org> (raw)
From: Dmitry Bogatov <KAction@gnu.org>
As I can see, definition with define-macro is hygienic and
move to syntax-rules adds two lines of code, but define-syntax
is considered preferable.
WDYT?
Signed-off-by: Dmitry Bogatov <KAction@gnu.org>
---
module/rnrs/bytevectors.scm | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/module/rnrs/bytevectors.scm b/module/rnrs/bytevectors.scm
index 9744359..856ad4a 100644
--- a/module/rnrs/bytevectors.scm
+++ b/module/rnrs/bytevectors.scm
@@ -75,9 +75,12 @@
(load-extension (string-append "libguile-" (effective-version))
"scm_init_bytevectors")
-(define-macro (endianness sym)
- (if (memq sym '(big little))
- `(quote ,sym)
- (error "unsupported endianness" sym)))
+(define-syntax endianness
+ (syntax-rules ()
+ ((_ sym)
+ (let ((qsym (quote sym)))
+ (if (memq qsym '(big little))
+ qsym
+ (error "unsupported endianness" qsym))))))
;;; bytevector.scm ends here
--
Recipients list generated via git-blame. Tell me, if you object.
next reply other threads:[~2013-09-28 5:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-28 5:25 KAction [this message]
2013-09-28 10:27 ` [PATCH] Replace define-macro with syntax-rules Taylan Ulrich B.
2013-09-29 20:38 ` Ian Price
2013-09-30 19:24 ` Taylan Ulrich B.
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=1380345956-1720-1-git-send-email-KAction@gnu.org \
--to=kaction@gnu.org \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=wingo@pobox.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).