Add a `guile-2' SRFI-0 feature.
authorLudovic Courtès <ludo@gnu.org>
Wed, 21 Oct 2009 21:41:56 +0000 (23:41 +0200)
committerLudovic Courtès <ludo@gnu.org>
Wed, 21 Oct 2009 21:41:56 +0000 (23:41 +0200)
* doc/ref/srfi-modules.texi (SRFI-0): Mention the `guile-2' feature.

* module/ice-9/boot-9.scm (%cond-expand-features): Add `guile-2'.

doc/ref/srfi-modules.texi
module/ice-9/boot-9.scm

index d3183e2..fbba7c5 100644 (file)
@@ -135,6 +135,7 @@ The Guile core has the following features,
 
 @example
 guile
+guile-2  ;; starting from Guile 2.x
 r5rs
 srfi-0
 srfi-4
@@ -162,6 +163,23 @@ how to load it with the Guile mechanism.
               (use-modules (srfi srfi-8))))
 @end example
 
+@cindex @code{guile-2} SRFI-0 feature
+@cindex portability between 2.0 and older versions
+Likewise, testing the @code{guile-2} feature allows code to be portable
+between Guile 2.0 and previous versions of Guile.  For instance, it
+makes it possible to write code that accounts for Guile 2.0's compiler,
+yet be correctly interpreted on 1.8 and earlier versions:
+
+@example
+(cond-expand (guile-2 (eval-when (compile)
+                        ;; This must be evaluated at compile time.
+                        (fluid-set! current-reader my-reader)))
+             (guile
+                      ;; Earlier versions of Guile do not have a
+                      ;; separate compilation phase.
+                      (fluid-set! current-reader my-reader)))
+@end example
+
 It should be noted that @code{cond-expand} is separate from the
 @code{*features*} mechanism (@pxref{Feature Tracking}), feature
 symbols in one are unrelated to those in the other.
index 140a761..7af2fd4 100644 (file)
@@ -3258,6 +3258,7 @@ module '(ice-9 q) '(make-q q-length))}."
 (define %cond-expand-features
   ;; Adjust the above comment when changing this.
   '(guile
+    guile-2
     r5rs
     srfi-0   ;; cond-expand itself
     srfi-4   ;; homogenous numeric vectors