summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2012-03-07 19:01:56 +0100
committerAndy Wingo <wingo@pobox.com>2012-03-07 19:02:00 +0100
commit283ab48d3f20a5c5281cafc29f0c30c8d8ace9ee (patch)
tree6f3be6882a89ddac6060033bbc50228b8d1eece1
parenta62b5c3d5431cf68d94af5397116ca38f7d15840 (diff)
downloadguile-283ab48d3f20a5c5281cafc29f0c30c8d8ace9ee.tar.gz
faster (make-prompt-tag); default-prompt-tag is a parameter
* module/ice-9/boot-9.scm (default-prompt-tag): Once parameters have booted, redefine as a parameter. (make-prompt-tag): Change from a gensym to a list. Thanks to Mark Weaver for the suggestion. * doc/ref/api-control.texi (Prompt Primitives): Update docs.
-rw-r--r--doc/ref/api-control.texi9
-rw-r--r--module/ice-9/boot-9.scm14
2 files changed, 18 insertions, 5 deletions
diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi
index ca7ad4af6..6eac8726f 100644
--- a/doc/ref/api-control.texi
+++ b/doc/ref/api-control.texi
@@ -494,14 +494,17 @@ those passed to @code{abort-to-prompt}.
@end deffn
@deffn {Scheme Procedure} make-prompt-tag [stem]
-Make a new prompt tag. Currently prompt tags are generated symbols.
-This may change in some future Guile version.
+Make a new prompt tag. A prompt tag is simply a unique object.
+Currently, a prompt tag is a fresh pair. This may change in some future
+Guile version.
@end deffn
@deffn {Scheme Procedure} default-prompt-tag
Return the default prompt tag. Having a distinguished default prompt
tag allows some useful prompt and abort idioms, discussed in the next
-section.
+section. Note that @code{default-prompt-tag} is actually a parameter,
+and so may be dynamically rebound using @code{parameterize}.
+@xref{Parameters}.
@end deffn
@deffn {Scheme Procedure} abort-to-prompt tag val1 val2 @dots{}
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 1630461e1..94538fe58 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -51,10 +51,12 @@
(define make-prompt-tag
(lambda* (#:optional (stem "prompt"))
- (gensym stem)))
+ ;; The only property that prompt tags need have is uniqueness in the
+ ;; sense of eq?. A one-element list will serve nicely.
+ (list stem)))
(define default-prompt-tag
- ;; not sure if we should expose this to the user as a fluid
+ ;; Redefined later to be a parameter.
(let ((%default-prompt-tag (make-prompt-tag)))
(lambda ()
%default-prompt-tag)))
@@ -1326,6 +1328,14 @@ VALUE."
+;;; Once parameters have booted, define the default prompt tag as being
+;;; a parameter.
+;;;
+
+(set! default-prompt-tag (make-parameter (default-prompt-tag)))
+
+
+
;;; Current ports as parameters.
;;;