mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 22:10:21 +02:00
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.
This commit is contained in:
parent
a62b5c3d54
commit
283ab48d3f
2 changed files with 18 additions and 5 deletions
|
@ -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{}
|
||||
|
|
|
@ -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.
|
||||
;;;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue