GNU bug report logs -
#12341
define does not support lambda shorthand notation, define-public does
Previous Next
Reported by: David Kastrup <dak <at> gnu.org>
Date: Mon, 3 Sep 2012 18:08:01 UTC
Severity: normal
Done: Ian Price <ianprice90 <at> googlemail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Court$(D+2(Bs) writes:
> I$B!G(Bm inclined to live with the inconsistency, but I$B!G(Bm open to
> suggestions.
A quick git grep doesn't show any uses of curried define-public in the
guile code base, so the fix is pretty simple. I'm open to better
approaches though, since it does duplicate code, though this code is IMO
trivial.
--
Ian Price -- shift-reset.com
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
[0001-define-public-is-no-a-longer-curried-definition-by-d.patch (text/x-patch, inline)]
From fb23b4a49e9c1f5c15ef0ceb2ee1903ebfddd71a Mon Sep 17 00:00:00 2001
From: Ian Price <ianprice90 <at> googlemail.com>
Date: Tue, 4 Sep 2012 13:18:58 +0100
Subject: [PATCH] `define-public' is no a longer curried definition by
default.
* module/ice-9/boot-9.scm (define-public): Remove currying functionality.
* module/ice-9/curried-definitions.scm (define-public): New export.
---
module/ice-9/boot-9.scm | 4 +++-
module/ice-9/curried-definitions.scm | 14 +++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 5ed543a..cf8252a 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -3321,7 +3321,9 @@ module '(ice-9 q) '(make-q q-length))}."
(define-syntax define-public
(syntax-rules ()
((_ (name . args) . body)
- (define-public name (lambda args . body)))
+ (begin
+ (define name (lambda args . body))
+ (export name)))
((_ name val)
(begin
(define name val)
diff --git a/module/ice-9/curried-definitions.scm b/module/ice-9/curried-definitions.scm
index d55f1fb..8c684a1 100644
--- a/module/ice-9/curried-definitions.scm
+++ b/module/ice-9/curried-definitions.scm
@@ -16,7 +16,8 @@
(define-module (ice-9 curried-definitions)
#:replace ((cdefine . define)
- (cdefine* . define*)))
+ (cdefine* . define*)
+ define-public))
(define-syntax cdefine
(syntax-rules ()
@@ -39,3 +40,14 @@
(lambda* rest body body* ...)))
((_ . rest)
(define* . rest))))
+
+(define-syntax define-public
+ (syntax-rules ()
+ ((_ (name . args) . body)
+ (begin
+ (cdefine (name . args) . body)
+ (export name)))
+ ((_ name val)
+ (begin
+ (define name val)
+ (export name)))))
--
1.7.7.6
This bug report was last modified 12 years and 321 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.