unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ian Price <ianprice90@googlemail.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: 12341@debbugs.gnu.org, David Kastrup <dak@gnu.org>
Subject: bug#12341: define does not support lambda shorthand notation, define-public does
Date: Tue, 04 Sep 2012 13:21:39 +0100	[thread overview]
Message-ID: <87vcfu9dws.fsf@Kagami.home> (raw)
In-Reply-To: <87zk56onnn.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 03 Sep 2012 22:29:48 +0200")

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=iso-2022-jp-2, Size: 518 bytes --]

ludo@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"


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: define-public patch --]
[-- Type: text/x-patch, Size: 1833 bytes --]

From fb23b4a49e9c1f5c15ef0ceb2ee1903ebfddd71a Mon Sep 17 00:00:00 2001
From: Ian Price <ianprice90@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


  reply	other threads:[~2012-09-04 12:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 18:05 bug#12341: define does not support lambda shorthand notation, define-public does David Kastrup
2012-09-03 20:29 ` Ludovic Courtès
2012-09-04 12:21   ` Ian Price [this message]
2012-09-04 12:36     ` David Kastrup
2012-09-04 14:37       ` Ian Price
2012-09-05 21:16     ` Ludovic Courtès
2012-09-06 20:27       ` Ian Price
2012-09-06 20:37         ` Ludovic Courtès
2012-09-06 21:37           ` Ian Price

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=87vcfu9dws.fsf@Kagami.home \
    --to=ianprice90@googlemail.com \
    --cc=12341@debbugs.gnu.org \
    --cc=dak@gnu.org \
    --cc=ludo@gnu.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).