unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Replace define-macro with syntax-rules
@ 2013-09-28  5:25 KAction
  2013-09-28 10:27 ` Taylan Ulrich B.
  0 siblings, 1 reply; 4+ messages in thread
From: KAction @ 2013-09-28  5:25 UTC (permalink / raw)
  To: guile-devel; +Cc: wingo, ludo, Dmitry Bogatov

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.




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-30 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28  5:25 [PATCH] Replace define-macro with syntax-rules KAction
2013-09-28 10:27 ` Taylan Ulrich B.
2013-09-29 20:38   ` Ian Price
2013-09-30 19:24     ` Taylan Ulrich B.

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).