unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andreas Rottmann <a.rottmann@gmx.at>
To: Guile Development <guile-devel@gnu.org>
Subject: [PATCH] Don't mix definitions and expressions in SRFI-9
Date: Sun, 06 Mar 2011 17:39:58 +0100	[thread overview]
Message-ID: <8762rwqk2p.fsf@gmx.at> (raw)

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]


As always, see the patch header for details.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: srfi-9-fix.diff --]
[-- Type: text/x-diff, Size: 2552 bytes --]

From: Andreas Rottmann <a.rottmann@gmx.at>
Subject: Don't mix definitions and expressions in SRFI-9

The expansion of `define-inlinable' contained an expression, which made
SRFI-9's `define-record-type' fail in non-toplevel contexts ("definition
used in expression context").

* module/srfi/srfi-9.scm (define-inlinable): Get rid of apparently
  useless expression in the expansion, so the expansion yields only
  definitions.
* test-suite/tests/srfi-9.test (non-toplevel): New test verifying that
  `define-record-type' works in non-toplevel context as well.

---
 module/srfi/srfi-9.scm       |    3 +--
 test-suite/tests/srfi-9.test |   12 +++++++++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/module/srfi/srfi-9.scm b/module/srfi/srfi-9.scm
index 80c3b60..7c2b073 100644
--- a/module/srfi/srfi-9.scm
+++ b/module/srfi/srfi-9.scm
@@ -1,6 +1,6 @@
 ;;; srfi-9.scm --- define-record-type
 
-;; 	Copyright (C) 2001, 2002, 2006, 2009, 2010 Free Software Foundation, Inc.
+;; 	Copyright (C) 2001, 2002, 2006, 2009, 2010, 2011 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
@@ -81,7 +81,6 @@
          #`(begin
              (define (proc-name formals ...)
                body ...)
-             proc-name ;; unused
              (define-syntax name
                (lambda (x)
                  (syntax-case x ()
diff --git a/test-suite/tests/srfi-9.test b/test-suite/tests/srfi-9.test
index cf933a8..f8006c4 100644
--- a/test-suite/tests/srfi-9.test
+++ b/test-suite/tests/srfi-9.test
@@ -1,7 +1,7 @@
 ;;;; srfi-9.test --- Test suite for Guile's SRFI-9 functions. -*- scheme -*-
 ;;;; Martin Grabmueller, 2001-05-10
 ;;;;
-;;;; Copyright (C) 2001, 2006, 2007, 2010 Free Software Foundation, Inc.
+;;;; Copyright (C) 2001, 2006, 2007, 2010, 2011 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
@@ -93,3 +93,13 @@
   ;; prior to guile 1.6.9 and 1.8.1 this wan't enforced
   (pass-if-exception "set-y! on bar" exception:wrong-type-arg
      (set-y! b 99)))
+
+(with-test-prefix "non-toplevel"
+    
+  (define-record-type :frotz (make-frotz a b) frotz?
+    (a frotz-a) (b frotz-b set-frotz-b!))
+
+  (pass-if "construction"
+    (let ((frotz (make-frotz 1 2)))
+      (and (= (frotz-a frotz) 1)
+           (= (frotz-b frotz) 2)))))
-- 
tg: (d59dd06..) t/srfi-9-fix (depends on: stable-2.0)

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]


Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

             reply	other threads:[~2011-03-06 16:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06 16:39 Andreas Rottmann [this message]
2011-03-06 22:26 ` [PATCH] Don't mix definitions and expressions in SRFI-9 Ludovic Courtès
2011-03-06 23:05   ` Alex Shinn
2011-03-06 23:21     ` Ludovic Courtès
2011-03-07  0:31   ` Andreas Rottmann
2011-03-07 10:55     ` Andy Wingo
2011-03-07 10:52   ` Andy Wingo
2011-03-07 13:36     ` Ludovic Courtès
2011-03-08  0:37       ` Andreas Rottmann
2011-03-09 20:43         ` Ludovic Courtès

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=8762rwqk2p.fsf@gmx.at \
    --to=a.rottmann@gmx.at \
    --cc=guile-devel@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).