guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-9-54-g922


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-9-54-g9225df3
Date: Wed, 07 Apr 2010 22:36:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=9225df3c551c9b28cf16f5c4aab8cf1183f44577

The branch, master has been updated
       via  9225df3c551c9b28cf16f5c4aab8cf1183f44577 (commit)
       via  8f44138ac6c91d9e20c3557ee6e5389900a7730e (commit)
      from  de9df04a0ce8b87e5843b0fcdfcf105437618492 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9225df3c551c9b28cf16f5c4aab8cf1183f44577
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 8 00:36:53 2010 +0200

    add (ice-9 curried definitions)
    
    * module/Makefile.am:
    * module/ice-9/curried-definitions.scm: New module, implementing
      SICM-style currying.
    
    * test-suite/Makefile.am:
    * test-suite/tests/curried-definitions.test: A test.

commit 8f44138ac6c91d9e20c3557ee6e5389900a7730e
Author: Andy Wingo <address@hidden>
Date:   Thu Apr 8 00:29:52 2010 +0200

    fix bug when importing bindings that were already imported and used
    
    * module/ice-9/boot-9.scm (module-use!, module-use-interfaces!): When
      adding the module or interface to the use list, clear the cached
      imports obarray.
    
      The test case is coming next.

-----------------------------------------------------------------------

Summary of changes:
 module/Makefile.am                                 |    1 +
 module/ice-9/boot-9.scm                            |    3 +-
 .../simple.scm => ice-9/curried-definitions.scm}   |   34 +++++++++------
 test-suite/Makefile.am                             |    1 +
 test-suite/tests/curried-definitions.test          |   46 ++++++++++++++++++++
 5 files changed, 70 insertions(+), 15 deletions(-)
 copy module/{oop/goops/simple.scm => ice-9/curried-definitions.scm} (54%)
 create mode 100644 test-suite/tests/curried-definitions.test

diff --git a/module/Makefile.am b/module/Makefile.am
index ca38524..16013b0 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -179,6 +179,7 @@ ICE_9_SOURCES = \
   ice-9/calling.scm \
   ice-9/common-list.scm \
   ice-9/control.scm \
+  ice-9/curried-definitions.scm \
   ice-9/debug.scm \
   ice-9/debugger.scm \
   ice-9/documentation.scm \
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index f549393..f0877b7 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -1978,7 +1978,7 @@ If there is no handler at all, Guile prints an error and 
then exits."
                                                      (module-name interface))))
                                           (module-uses module))
                                   (list interface)))
-
+        (hash-clear! (module-import-obarray module))
         (module-modified module))))
 
 ;; MODULE-USE-INTERFACES! module interfaces
@@ -1988,6 +1988,7 @@ If there is no handler at all, Guile prints an error and 
then exits."
 (define (module-use-interfaces! module interfaces)
   (set-module-uses! module
                     (append (module-uses module) interfaces))
+  (hash-clear! (module-import-obarray module))
   (module-modified module))
 
 
diff --git a/module/oop/goops/simple.scm b/module/ice-9/curried-definitions.scm
similarity index 54%
copy from module/oop/goops/simple.scm
copy to module/ice-9/curried-definitions.scm
index bc5405a..d7db1f0 100644
--- a/module/oop/goops/simple.scm
+++ b/module/ice-9/curried-definitions.scm
@@ -1,7 +1,5 @@
-;;; installed-scm-file
-
-;;;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-;;;; 
+;;; Copyright (C) 2010  Free Software Foundation, Inc.
+;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
 ;;;; License as published by the Free Software Foundation; either
@@ -15,17 +13,25 @@
 ;;;; You should have received a copy of the GNU Lesser General Public
 ;;;; License along with this library; if not, write to the Free Software
 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
-;;;; 
-
 
-(define-module (oop goops simple)
-  :use-module (oop goops accessors)
-  :export (define-class)
-  :no-backtrace)
+(define-module (ice-9 curried-definitions)
+  #:replace ((cdefine . define)
+             (cdefine* . define*)))
 
-(define-syntax define-class
+(define-syntax cdefine
   (syntax-rules ()
-    ((_ arg ...)
-     (define-class-with-accessors-keywords arg ...))))
+    ((_ ((head . tail) . rest) body body* ...)
+     (cdefine (head . tail)
+       (lambda rest body body* ...)))
+    ((_ (head . rest) body body* ...)
+     (define head
+       (lambda rest body body* ...)))))
 
-(module-use! %module-public-interface (resolve-interface '(oop goops)))
+(define-syntax cdefine*
+  (syntax-rules ()
+    ((_ ((head . tail) . rest) body body* ...)
+     (cdefine* (head . tail)
+       (lambda* rest body body* ...)))
+    ((_ (head . rest) body body* ...)
+     (define* head
+       (lambda* rest body body* ...)))))
diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am
index bc166c4..006b131 100644
--- a/test-suite/Makefile.am
+++ b/test-suite/Makefile.am
@@ -35,6 +35,7 @@ SCM_TESTS = tests/00-initial-env.test         \
            tests/common-list.test              \
            tests/control.test                  \
            tests/continuations.test            \
+           tests/curried-definitions.test      \
            tests/ecmascript.test               \
            tests/elisp.test                    \
            tests/elisp-compiler.test           \
diff --git a/test-suite/tests/curried-definitions.test 
b/test-suite/tests/curried-definitions.test
new file mode 100644
index 0000000..650288f
--- /dev/null
+++ b/test-suite/tests/curried-definitions.test
@@ -0,0 +1,46 @@
+;;;; curried-definitions.test          -*- scheme -*-
+;;;; Copyright (C) 2010  Free Software Foundation, Inc.
+;;;;
+;;;; This library is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU Lesser General Public
+;;;; License as published by the Free Software Foundation; either
+;;;; version 3 of the License, or (at your option) any later version.
+;;;; 
+;;;; This library is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;;; Lesser General Public License for more details.
+;;;; 
+;;;; You should have received a copy of the GNU Lesser General Public
+;;;; License along with this library; if not, write to the Free Software
+;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
+
+(define-module (test-suite test-curried-definitions)
+  #:use-module (test-suite lib)
+  #:use-module (ice-9 curried-definitions))
+
+(with-test-prefix "define"
+  (pass-if "define works as usual"
+    (equal? 34
+            (primitive-eval '(let ()
+                               (define (foo)
+                                 34)
+                               (foo)))))
+  (pass-if "define works as usual (2)"
+    (equal? 134
+            (primitive-eval '(let ()
+                               (define (foo x)
+                                 (+ x 34))
+                               (foo 100)))))
+  (pass-if "currying once"
+    (equal? 234
+            (primitive-eval '(let ()
+                               (define ((foo) x)
+                                 (+ x 34))
+                               ((foo) 200)))))
+  (pass-if "currying twice"
+    (equal? 334
+            (primitive-eval '(let ()
+                               (define (((foo)) x)
+                                 (+ x 34))
+                               (((foo)) 300))))))


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]