1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

13 commits

Author SHA1 Message Date
Ludovic Courtès
5ef102cc93 SRFI-9: Set the `record-constructor' slot of the RTD.
Fixed <http://bugs.gnu.org/11196>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* module/srfi/srfi-9.scm (define-record-type): Define the contructor
  before TYPE-NAME.  Set RTD's constructor field.

* test-suite/tests/srfi-9.test ("record compatibility"): New test
  prefix.
2012-04-10 00:17:39 +02:00
Andy Wingo
8761623524 srfi-9 record compatibility with boot-9 records
* module/srfi/srfi-9.scm (define-record-type): Instead of defining the
  RTD using make-vtable, use make-struct with the record-type-vtable,
  and record the type name and fields names in the vtable.  This way
  SRFI-9 records are compatible with boot-9 records.  Also we use a
  generic printer, instead of generating one anew.
2011-08-17 10:47:04 +02:00
Ludovic Courtès
756b1dfa6e Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).
Partially reverts 165b10ddfa and
531c9f1dc5.

* module/srfi/srfi-9.scm (define-inlinable): New macro.
2011-04-27 22:26:05 +02:00
Andreas Rottmann
165b10ddfa Move `define-inlinable' into the default namespace
* module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9.
* module/srfi/srfi-9 (define-inlinable): Removed here.

* doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection
  about `define-inlinable'.
2011-04-07 01:12:26 +02:00
Ludovic Courtès
b075a6d766 Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once.
* module/srfi/srfi-9.scm (define-inlinable): When inlining, evaluate the
  arguments only once.  Reported by Andreas Rottmann; thanks to Andy
  Wingo for the elegant solution.

* test-suite/tests/srfi-9.test ("side-effecting arguments"): New test
  prefix.
2011-03-11 21:02:30 +01:00
Andreas Rottmann
531c9f1dc5 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.  At the same time, use a space in the generated names to
  lessen the chances of name conflicts, also avoiding -Wunused-toplevel
  warnings.
* test-suite/tests/srfi-9.test (non-toplevel): New test verifying that
  `define-record-type' works in non-toplevel context as well.
* doc/ref/srfi-modules.texi (SRFI-9 - define-record-type): Add
  subsubsection noting that Guile does not enforce top-levelness.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2011-03-09 21:36:54 +01:00
Andreas Rottmann
c4a8200fa0 Fix SRFI-9 for records without fields
* module/srfi/srfi-9.scm (define-record-type): Deal with fieldless records.
* test-suite/tests/srfi-9.test: Add a fieldless record definition.
2010-06-19 14:52:56 +02:00
Ludovic Courtès
30a700c8c1 Inline SRFI-9 constructors too.
* module/srfi/srfi-9.scm (define-record-type)[constructor]: Use
  `define-inlinable' instead of `define'.

* test-suite/lib.scm (exception:syntax-pattern-unmatched): New variable.

* test-suite/tests/srfi-9.test ("constructor")["foo 0 args (inline)",
  "foo 2 args (inline)"]: New tests.
  ["foo 0 args", "foo 2 args"]: Adjust to constructor inlining.

* testsuite/t-records.scm: Remove wrong-arg-count case.
2010-02-01 00:25:51 +01:00
Ludovic Courtès
61cbfff509 SRFI-9: Fix `define-inlinable'.
* module/srfi/srfi-9.scm (define-inlinable): Fix the catch-all case of
  the generated macro.
2010-02-01 00:25:51 +01:00
Ludovic Courtès
fe258c43a1 SRFI-9: Make accessors inlinable.
* module/srfi/srfi-9.scm (define-inlinable): New macro.
  (define-record-type): Use it.
2009-12-11 13:03:46 +01:00
Ludovic Courtès
09a8dc97db SRFI-9: Reimplement in terms of structs, using `syntax-case'.
* module/srfi/srfi-9.scm (define-record-type): Rewrite to use raw
  structs instead of records.  Use `syntax-case' instead of
  `define-macro'.
2009-12-11 13:03:46 +01:00
Neil Jerram
83ba2d3750 Complete changing license to LGPLv3+
(Still guile-readline to do, but that will all be GPLv3+.)
2009-06-17 22:30:26 +01:00
Andy Wingo
ea93465de7 move scm srfi files to module/srfi, and compile them.
* .gitignore: Add gdb-pre-inst-guile.

* configure.in: Add module/srfi/Makefile.

* module/Makefile.am: Add srfi/.

* module/srfi/: SRFI scheme files moved here, and compiled.

* srfi/Makefile.am: Remove the bits about the scheme files.
2008-11-01 13:49:23 +01:00
Renamed from srfi/srfi-9.scm (Browse further)