* module/ice-9/boot-9.scm (current-language): New parameter.
* module/system/base/language.scm (*current-language*): Pull fluid from
parameter.
(current-language): Now a re-exported parameter.
* doc/ref/compiler.texi: Update reference from *current-language* fluid
to current-language parameter.
* module/system/base/compile.scm (compile-and-load):
* module/ice-9/top-repl.scm (top-repl): Default to the current language,
not to Scheme.
* module/ice-9/eval-string.scm:
* module/system/base/language.scm:
* module/system/repl/command.scm:
* module/system/repl/repl.scm: Update to use current-language parameter
and parameterize.
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
-@c Copyright (C) 2008, 2009, 2010
+@c Copyright (C) 2008, 2009, 2010, 2013
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
fast.
@end deffn
-There is a notion of a ``current language'', which is maintained in
-the @code{*current-language*} fluid. This language is normally Scheme,
-and may be rebound by the user. The run-time compilation interfaces
+There is a notion of a ``current language'', which is maintained in the
+@code{current-language} parameter, defined in the core @code{(guile)}
+module. This language is normally Scheme, and may be rebound by the
+user. The run-time compilation interfaces
(@pxref{Read/Load/Eval/Compile}) also allow you to choose other source
and target languages.
\f
+;;;
+;;; Languages.
+;;;
+
+;; The language can be a symbolic name or a <language> object from
+;; (system base language).
+;;
+(define current-language (make-parameter 'scheme))
+
+
+\f
;;; {Running Repls}
;;;
;;; Evaluating code from users
-;;; Copyright (C) 2011 Free Software Foundation, Inc.
+;;; Copyright (C) 2011, 2013 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
(lookup-language x)))
(define* (read-and-eval port #:key (lang (current-language)))
- (with-fluids ((*current-language* (ensure-language lang)))
+ (parameterize ((current-language (ensure-language lang)))
(define (read)
((language-reader (current-language)) port (current-module)))
(define (eval exp)
;;; -*- mode: scheme; coding: utf-8; -*-
;;;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;;;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;;;; 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 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
"warning: failed to install locale: ~a~%"
(strerror (car errno))))))
- (let ((status (start-repl 'scheme)))
+ (let ((status (start-repl (current-language))))
(run-hook exit-hook)
status)))))
file)
comp)))
-(define* (compile-and-load file #:key (from 'scheme) (to 'value)
+(define* (compile-and-load file #:key (from (current-language)) (to 'value)
(env (current-module)) (opts '())
(canonicalization 'relative))
(with-fluids ((%file-port-name-canonicalization canonicalization))
;;; Multi-language support
-;; Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010, 2011, 2013 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
lookup-compilation-order lookup-decompilation-order
invalidate-compilation-cache! default-environment
- *current-language* current-language))
+ *current-language*)
+
+ #:re-export (current-language))
\f
;;;
;;; Current language
;;;
-(define *current-language* (make-fluid 'scheme))
-
-(define (current-language)
- (fluid-ref *current-language*))
+;; Deprecated; use current-language instead.
+(define *current-language* (parameter-fluid current-language))
;;; Repl commands
-;; Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010, 2011, 2013 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
(cur (repl-language repl)))
(format #t "Happy hacking with ~a! To switch back, type `,L ~a'.\n"
(language-title lang) (language-name cur))
- (fluid-set! *current-language* lang)
+ (current-language lang)
(set! (repl-language repl) lang)))
\f
;;; Read-Eval-Print Loop
-;; Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010, 2011, 2013 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
;;;
(define* (start-repl #:optional (lang (current-language)) #:key debug)
- ;; ,language at the REPL will fluid-set! the *current-language*. Make
- ;; sure that it does so in a new scope.
- (with-fluids ((*current-language* lang))
+ ;; ,language at the REPL will update the current-language. Make
+ ;; sure that it does so in a new dynamic scope.
+ (parameterize ((current-language lang))
(run-repl (make-repl lang debug))))
;; (put 'abort-on-error 'scheme-indent-function 1)