~ chicken-core (chicken-5) fdeaaaab23e3a3c3d6c82e7dab7b088b7b433c97


commit fdeaaaab23e3a3c3d6c82e7dab7b088b7b433c97
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Mon Oct 16 22:56:05 2017 +1300
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Mon Oct 16 16:11:13 2017 +0200

    Remove `use' and `use-for-syntax'
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/NEWS b/NEWS
index 6828612f..0e615c07 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,8 @@
   - The core units have been converted to modules under the "chicken"
     namespace.
   - Added support for list-style library names.
+  - The "use" and "use-for-syntax" special forms have been removed
+    in favor of "import" and "import-for-syntax" to reduce confusion.
 
 - Syntax expander
   - Removed support for (define-syntax (foo e r c) ...), which was
diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index 129648a0..afe62229 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -1153,14 +1153,8 @@
 			   ,(car head))
 	  `(##core#letrec* ((,head ,@(cddr form))) ,head))))))
 
-;;; use
 
-(##sys#extend-macro-environment
- 'use '()
- (##sys#er-transformer
-  (lambda (x r c)
-    (##sys#check-syntax 'use x '(_ . #(_ 0)))
-    `(,(r 'require-extension) ,@(cdr x)))))
+;;; SRFI-55
 
 (##sys#extend-macro-environment
  'require-extension
@@ -1310,14 +1304,6 @@
       (,(r 'define) ,@(cdr form))))))
 
 
-(##sys#extend-macro-environment
- 'use-for-syntax '()
- (##sys#er-transformer
-  (lambda (x r c)
-    (##sys#check-syntax 'use-for-syntax x '(_ . #(_ 0)))
-    `(,(r 'require-extension-for-syntax) ,@(cdr x)))))
-
-
 ;;; compiler syntax
 
 (##sys#extend-macro-environment
diff --git a/manual/Accessing external objects b/manual/Accessing external objects
index accd551d..8f83edaf 100644
--- a/manual/Accessing external objects	
+++ b/manual/Accessing external objects	
@@ -215,8 +215,7 @@ and the "egg" which calls the C functions can be implemented like this:
 
 <enscript highlight=scheme>
 (module memcpy-demo (input->output)
-    (import chicken scheme foreign)
-    (use srfi-4)
+    (import chicken scheme foreign srfi-4)
 
     (define CopyResults (foreign-lambda void "CopyResults" f64vector))
 
diff --git a/manual/Getting started b/manual/Getting started
index 86645a7a..c569d8a9 100644
--- a/manual/Getting started	
+++ b/manual/Getting started	
@@ -345,8 +345,8 @@ following little program:
 
 <enscript highlight=scheme>
 
-(use irregex) ; irregex, the regular expression library, is one of the
-     	      ; libraries included with CHICKEN.
+(import irregex) ; irregex, the regular expression library, is one of the
+                 ; libraries included with CHICKEN.
 
 (define (process-line line re rplc) 
   (irregex-replace/all re line rplc))
@@ -529,7 +529,7 @@ local CHICKEN repository.
 
 Now we can use our new egg. 
 
- #;1> (use uri-common)
+ #;1> (import uri-common)
  ; loading /usr/lib/chicken/5/uri-common.import.so ...
  ; [... other loaded files omitted for clarity ...]
  
diff --git a/manual/Modules b/manual/Modules
index 8279526a..f65b41eb 100644
--- a/manual/Modules
+++ b/manual/Modules
@@ -337,14 +337,6 @@ and used in an identical manner:
   #;3> (greet "you")
   Hello, you !
 
-If you are depending on external libraries inside your module, follow the general rule of {{(import chicken scheme) (use anything-else)}} like so:
-
- (module test (hello greet)
-   (import chicken scheme)
-   (use posix)
-   (use srfi-4)
-   ...)
-
 If you want to keep macro-definitions in a separate file, use import
 libraries:
 
diff --git a/manual/faq b/manual/faq
index 4916d793..a1669ba7 100644
--- a/manual/faq
+++ b/manual/faq
@@ -71,7 +71,7 @@ The short answer is to use the [[/egg/numbers|numbers]] egg:
 <enscript highlight=scheme>
 % chicken-install numbers
 % csi -q
-#;1> (use numbers)
+#;1> (import numbers)
 </enscript>
 
 The long answer:
@@ -331,7 +331,7 @@ the file containing the sharp-comma form, like this:
 When you try to {{use}} a built-in unit such as {{posix}}, you may get the following error:
 
 <enscript highlight=scheme>
- #;1> (use posix)
+ #;1> (import posix)
  ; loading library posix ...
  Error: (load-library) unable to load library
  posix
@@ -796,7 +796,7 @@ recommended. After installing parley, add the following to your
 {{~/.csirc}} or equivalent file:
 
 <enscript highlight=scheme>
-(use parley)
+(import parley)
 (let ((old (current-input-port)))
   (current-input-port (make-parley-port old)))
 </enscript>
@@ -845,7 +845,7 @@ Alternatively, you can call the {{repository-path}} Scheme procedure before load
 
 <enscript highlight=scheme>
 (repository-path "/home/azul/eggs")
-(use format-modular)
+(import format-modular)
 </enscript>
 
 Note, however, that using {{repository-path}} as above hard-codes the location of your eggs in your source files.  While this might not be an issue in your case, it might be safe to keep this configuration outside of the source code (that is, specifying it as an environment variable) to make it easier to maintain.
diff --git a/misc/chicken.el b/misc/chicken.el
index 3ab4ff50..5d4bfe3c 100644
--- a/misc/chicken.el
+++ b/misc/chicken.el
@@ -150,7 +150,6 @@
 	(dotimes 1)
 	(compiler-typecase 1)
 	(ecase 1)
-	(use 0)
 	(require-extension 0)
 	(import 0)
 	(handle-exceptions 2)
diff --git a/scripts/make-wrapper.scm b/scripts/make-wrapper.scm
index 4b39136a..2effd459 100644
--- a/scripts/make-wrapper.scm
+++ b/scripts/make-wrapper.scm
@@ -2,9 +2,7 @@
 ;
 ; usage: csi -s make-wrapper.scm NAME BINPATH
 
-
-(use pathname)
-
+(import (chicken pathname))
 
 (let* ((args (command-line-arguments))
        (name (car args))
diff --git a/scripts/mini-salmonella.scm b/scripts/mini-salmonella.scm
index 211aa75a..45bffee9 100644
--- a/scripts/mini-salmonella.scm
+++ b/scripts/mini-salmonella.scm
@@ -4,7 +4,7 @@
 (module mini-salmonella ()
 
 (import scheme chicken)
-(use posix file extras data-structures setup-api (chicken process))
+(import posix file extras data-structures setup-api (chicken process))
 
 (define (usage code)
   (print "usage: mini-salmonella [-h] [-test] [-debug] [-download] [-trunk] EGGDIR [PREFIX]")
diff --git a/scripts/setversion b/scripts/setversion
index f4846b3c..54aa4123 100755
--- a/scripts/setversion
+++ b/scripts/setversion
@@ -3,7 +3,8 @@
 exec csi -s "$0" "$@"
 |#
 
-(use file format io irregex (chicken process) (chicken string))
+(import (chicken file) (chicken format) (chicken io)
+        (chicken irregex) (chicken process) (chicken string))
 
 (define buildversion (with-input-from-file "buildversion" read-line))
 
diff --git a/tests/apply-test.scm b/tests/apply-test.scm
index 563effab..f1372d56 100644
--- a/tests/apply-test.scm
+++ b/tests/apply-test.scm
@@ -1,4 +1,4 @@
-(use format (chicken platform))
+(import format (chicken platform))
 
 (define (list-tabulate n proc)
   (let loop ((i 0))
diff --git a/tests/arithmetic-test.scm b/tests/arithmetic-test.scm
index 36e6c136..a3d37354 100644
--- a/tests/arithmetic-test.scm
+++ b/tests/arithmetic-test.scm
@@ -15,7 +15,7 @@
   (else))
 
 
-(use pretty-print random (chicken platform))
+(import pretty-print random (chicken platform))
 
 (define range 2)
 (define random-range 32000)
diff --git a/tests/compiler-tests-3.scm b/tests/compiler-tests-3.scm
index fb3118a4..6b437ccc 100644
--- a/tests/compiler-tests-3.scm
+++ b/tests/compiler-tests-3.scm
@@ -1,6 +1,6 @@
 ;;; compiler-tests-3.scm - tests for unboxing
 
-(use flonum)
+(import flonum)
 
 ;;; unboxing introduced binding in test-position of conditional
 
diff --git a/tests/embedded2.scm b/tests/embedded2.scm
index d2d8eece..e7aee2f0 100644
--- a/tests/embedded2.scm
+++ b/tests/embedded2.scm
@@ -1,4 +1,4 @@
-(use gc pretty-print)
+(import gc pretty-print)
 
 #>
 #include <assert.h>
diff --git a/tests/embedded4.scm b/tests/embedded4.scm
index f1c49812..6550b612 100644
--- a/tests/embedded4.scm
+++ b/tests/embedded4.scm
@@ -1,6 +1,6 @@
 ;;; x.scm
 
-(use gc)
+(import gc)
 
 (define (bar x) (gc) (* x x))
 
diff --git a/tests/fft.scm b/tests/fft.scm
index 5815a417..c43784a6 100644
--- a/tests/fft.scm
+++ b/tests/fft.scm
@@ -9,7 +9,7 @@
      (block)
      (not safe)))
   (else
-   (use bitwise flonum)))
+   (import bitwise flonum)))
 
 ;;; All the following redefinitions are *ignored* by the Gambit compiler
 ;;; because of the declarations above.
@@ -56,7 +56,7 @@
     (defalias list->f64vector list->vector)
     (defalias f64vector-length vector-length)) )
  (chicken
-  (use srfi-4))
+  (import srfi-4))
  (else) )
 
 ;;; end of *ignored* definitions
diff --git a/tests/finalizer-error-test.scm b/tests/finalizer-error-test.scm
index 3785dd20..171eb1dd 100644
--- a/tests/finalizer-error-test.scm
+++ b/tests/finalizer-error-test.scm
@@ -1,6 +1,6 @@
 ;;;; finalizer-error-test.scm - by "megane"
 
-(use gc)
+(import gc)
 
 (define n 10000)
 
diff --git a/tests/fixnum-tests.scm b/tests/fixnum-tests.scm
index 44648884..86e54d3a 100644
--- a/tests/fixnum-tests.scm
+++ b/tests/fixnum-tests.scm
@@ -1,4 +1,4 @@
-(use (chicken platform))
+(import (chicken platform))
 
 (define (fxo+ x y) (##core#inline "C_i_o_fixnum_plus" x y))
 (define (fxo- x y) (##core#inline "C_i_o_fixnum_difference" x y))
diff --git a/tests/functor-tests.scm b/tests/functor-tests.scm
index 1858da58..7fa5531f 100644
--- a/tests/functor-tests.scm
+++ b/tests/functor-tests.scm
@@ -1,7 +1,7 @@
 ;;;; functor-tests.scm
 
 
-(use data-structures port pretty-print)
+(import data-structures port pretty-print)
 
 
 (include "test.scm")
diff --git a/tests/library-tests.scm b/tests/library-tests.scm
index 6e43068e..0ac5e2be 100644
--- a/tests/library-tests.scm
+++ b/tests/library-tests.scm
@@ -1,6 +1,6 @@
 ;;;; library-tests.scm
 
-(use chicken.blob bitwise flonum keyword port)
+(import chicken.blob bitwise flonum keyword port)
 
 (define-syntax assert-fail
   (syntax-rules ()
diff --git a/tests/lolevel-tests.scm b/tests/lolevel-tests.scm
index 88c84bf6..bb6c2990 100644
--- a/tests/lolevel-tests.scm
+++ b/tests/lolevel-tests.scm
@@ -1,7 +1,7 @@
 ;;;; Unit lolevel testing
 
-(use chicken.format chicken.locative chicken.platform
-     chicken.memory chicken.memory.representation srfi-4)
+(import chicken.format chicken.locative chicken.platform
+        chicken.memory chicken.memory.representation srfi-4)
 
 (define-syntax assert-error
   (syntax-rules ()
diff --git a/tests/loopy-test.scm b/tests/loopy-test.scm
index 855e06d2..c32f6888 100644
--- a/tests/loopy-test.scm
+++ b/tests/loopy-test.scm
@@ -1,5 +1,5 @@
-(use (only format printf)
-     (only time current-milliseconds))
+(import (only format printf)
+        (only time current-milliseconds))
 
 (load-relative "loopy-loop.scm")
 (load-relative "matchable.scm")
diff --git a/tests/module-tests.scm b/tests/module-tests.scm
index 12d63bc4..33a4b15e 100644
--- a/tests/module-tests.scm
+++ b/tests/module-tests.scm
@@ -173,7 +173,7 @@
 
 (module m15 ()
   (import scheme chicken)
-  (use (prefix (rename srfi-4 (u8vector u)) 99:))
+  (import (prefix (rename srfi-4 (u8vector u)) 99:))
   (print 99:u))
 
 
diff --git a/tests/numbers-string-conversion-tests.scm b/tests/numbers-string-conversion-tests.scm
index 5c20453f..c2b21ddb 100644
--- a/tests/numbers-string-conversion-tests.scm
+++ b/tests/numbers-string-conversion-tests.scm
@@ -21,7 +21,7 @@
 ;; (load "~~/lib/syntax-case") and then load this file, or use gsi's -:s switch
 ;;;
 
-(use format)			 ; Chicken w/ numbers
+(import format)			 ; Chicken w/ numbers
 ;(use-syntax (ice-9 syncase)) ; Guile
 
 ;; Set this to #f if the Scheme has no compnums at all, 'inexact if it only
diff --git a/tests/numbers-test-ashinn.scm b/tests/numbers-test-ashinn.scm
index ca39f2eb..713cae0c 100644
--- a/tests/numbers-test-ashinn.scm
+++ b/tests/numbers-test-ashinn.scm
@@ -1,6 +1,6 @@
 (include "test.scm")
 
-(use bitwise)
+(import bitwise)
 
 (current-test-epsilon 0) ;; We want exact comparisons by default
 
diff --git a/tests/numbers-test-gauche.scm b/tests/numbers-test-gauche.scm
index 8dd9079c..61423410 100644
--- a/tests/numbers-test-gauche.scm
+++ b/tests/numbers-test-gauche.scm
@@ -48,7 +48,7 @@
 
 ;; Gauche compat
 
-(use bitwise)
+(import bitwise)
 
 (define (greatest-fixnum) most-positive-fixnum)
 (define (least-fixnum) most-negative-fixnum)
diff --git a/tests/numbers-test.scm b/tests/numbers-test.scm
index 83222cb3..da3c70b3 100644
--- a/tests/numbers-test.scm
+++ b/tests/numbers-test.scm
@@ -2,7 +2,7 @@
 
 (include "test.scm")
 
-(use bitwise flonum format posix (chicken platform))
+(import bitwise flonum format posix (chicken platform))
 
 ;; The default "comparator" doesn't know how to deal with extended number types
 (current-test-comparator
diff --git a/tests/port-tests.scm b/tests/port-tests.scm
index 40d31e88..1330b443 100644
--- a/tests/port-tests.scm
+++ b/tests/port-tests.scm
@@ -1,5 +1,5 @@
-(use chicken.condition (only data-structures constantly)
-     file flonum format io port posix srfi-4 tcp)
+(import chicken.condition (only data-structures constantly)
+        file flonum format io port posix srfi-4 tcp)
 
 (include "test.scm")
 (test-begin)
diff --git a/tests/pp-test.scm b/tests/pp-test.scm
index a60670e5..af6f710d 100644
--- a/tests/pp-test.scm
+++ b/tests/pp-test.scm
@@ -1,7 +1,7 @@
 ;;;; pp-test.scm
 
-(use (only pretty-print pp)
-     (only port with-output-to-string))
+(import (only pretty-print pp)
+        (only port with-output-to-string))
 
 (define (pp->string thing)
   (with-output-to-string (cut pp thing)))
diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm
index 75569147..cb44d8cc 100644
--- a/tests/r7rs-tests.scm
+++ b/tests/r7rs-tests.scm
@@ -1,6 +1,6 @@
 ;; R7RS Tests
 
-(use (only port with-input-from-string with-output-to-string))
+(import (only port with-input-from-string with-output-to-string))
 
 ;; Copied from R4RS tests
 (define cur-section '())
diff --git a/tests/reader-tests.scm b/tests/reader-tests.scm
index bc0cb264..d8c9a820 100644
--- a/tests/reader-tests.scm
+++ b/tests/reader-tests.scm
@@ -1,8 +1,8 @@
 ;;;; reader-tests.scm
 
-(use (only io read-line read-string)
-     (only port with-input-from-string with-output-to-string)
-     (only read-syntax set-read-syntax! set-sharp-read-syntax!))
+(import (only io read-line read-string)
+        (only port with-input-from-string with-output-to-string)
+        (only read-syntax set-read-syntax! set-sharp-read-syntax!))
 
 (set-sharp-read-syntax! #\& (lambda (p) (read p) (values)))
 (set-sharp-read-syntax! #\^ (lambda (p) (read p)))
diff --git a/tests/sgrep.scm b/tests/sgrep.scm
index 79e5ad67..992add09 100644
--- a/tests/sgrep.scm
+++ b/tests/sgrep.scm
@@ -1,7 +1,7 @@
 ;;;; sgrep.scm - grepping benchmark
 
 
-(use io irregex port)
+(import io irregex port)
 
 
 (define big-string
diff --git a/tests/srfi-4-tests.scm b/tests/srfi-4-tests.scm
index a4313ab7..317d55e2 100644
--- a/tests/srfi-4-tests.scm
+++ b/tests/srfi-4-tests.scm
@@ -1,7 +1,7 @@
 ;;;; srfi-4-tests.scm
 
 
-(use srfi-4 port)
+(import srfi-4 port)
 (import-for-syntax chicken)
 
 (define-syntax test1
diff --git a/tests/srfi-45-tests.scm b/tests/srfi-45-tests.scm
index 10a7a636..7345e14e 100644
--- a/tests/srfi-45-tests.scm
+++ b/tests/srfi-45-tests.scm
@@ -1,8 +1,8 @@
 ;;; Tests adapted from SRFI 45 (for "lazy" -> "delay-force").
 ;;; That SRFI Copyright (C) André van Tonder (2003).
 
-(use (only format printf)
-     (only port with-output-to-string))
+(import (only format printf)
+        (only port with-output-to-string))
 
 (define *errors* 0)
 
diff --git a/tests/syntax-tests.scm b/tests/syntax-tests.scm
index f1ec80fa..29281faa 100644
--- a/tests/syntax-tests.scm
+++ b/tests/syntax-tests.scm
@@ -1,7 +1,7 @@
 ;;;; syntax-tests.scm - various macro tests
 
-(use-for-syntax pretty-print)
-(use gc pretty-print)
+(import-for-syntax pretty-print)
+(import gc pretty-print)
 
 (define-syntax t
   (syntax-rules ()
@@ -1085,10 +1085,10 @@
 (foo 3)
 
 
-;; #578: "use" with import-specifier has no effect for internal modules on csi's top-level
+;; #578: import with specifier has no effect for internal modules on csi's top-level
 
-(use srfi-4)
-(use (prefix srfi-4 other-))
+(import srfi-4)
+(import (prefix srfi-4 other-))
 u8vector
 other-u8vector
 
diff --git a/tests/test-finalizers-2.scm b/tests/test-finalizers-2.scm
index e0bc32c9..3f1170c6 100644
--- a/tests/test-finalizers-2.scm
+++ b/tests/test-finalizers-2.scm
@@ -1,6 +1,6 @@
 ;;;; test-finalizers-2.scm - test finalizers + GC roots
 
-(use gc)
+(import gc)
 
 (define (list-tabulate n proc)
   (let loop ((i 0))
diff --git a/tests/test-finalizers.scm b/tests/test-finalizers.scm
index 0e011cf0..0b723d06 100644
--- a/tests/test-finalizers.scm
+++ b/tests/test-finalizers.scm
@@ -2,7 +2,7 @@
 
 (import (chicken format))
 
-(use gc)
+(import gc)
 
 (##sys#eval-debug-level 0)		; disable keeping trace-buffer with frameinfo
 
diff --git a/tests/test-find-files.scm b/tests/test-find-files.scm
index e2a0d8a3..08866b74 100644
--- a/tests/test-find-files.scm
+++ b/tests/test-find-files.scm
@@ -1,7 +1,7 @@
-(use (chicken file)
-     (chicken process-context)
-     (chicken sort)
-     (chicken string))
+(import (chicken file)
+        (chicken process-context)
+        (chicken sort)
+        (chicken string))
 
 (include "test.scm")
 
diff --git a/tests/test-gc-hooks.scm b/tests/test-gc-hooks.scm
index 45be9d74..28b9c7f3 100644
--- a/tests/test-gc-hooks.scm
+++ b/tests/test-gc-hooks.scm
@@ -1,6 +1,6 @@
 ;;;; test-gc-hooks.scm
 
-(use gc)
+(import gc)
 
 #>
 
diff --git a/tests/test-glob.scm b/tests/test-glob.scm
index 62ccc6fb..9bebd3ef 100644
--- a/tests/test-glob.scm
+++ b/tests/test-glob.scm
@@ -1,7 +1,7 @@
 ;;;; test-glob.scm - test glob-pattern -> regex translation
 
 
-(use irregex)
+(import irregex)
 
 (assert (irregex-match (glob->sre "foo.bar") "foo.bar"))
 (assert (irregex-match (glob->sre "foo*") "foo.bar"))
diff --git a/tests/test-irregex.scm b/tests/test-irregex.scm
index c69736a3..b3e1520e 100644
--- a/tests/test-irregex.scm
+++ b/tests/test-irregex.scm
@@ -1,8 +1,8 @@
 ;;;: test-irregex.scm
 
 
-(use (only chicken.string string-split string-intersperse)
-     format io irregex port)
+(import (only chicken.string string-split string-intersperse)
+        format io irregex port)
 
 (include "test.scm")
 
diff --git a/tests/test.scm b/tests/test.scm
index 7c89a5ba..5c886f5d 100644
--- a/tests/test.scm
+++ b/tests/test.scm
@@ -2,8 +2,8 @@
 ;
 ; by Alex Shinn, lifted from match-test by felix
 
-(use (only chicken.string ->string))
-(use time) ; current-milliseconds
+(import (only chicken.string ->string))
+(import time) ; current-milliseconds
 
 (define *pass* 0)
 (define *fail* 0)
diff --git a/tests/typematch-tests.scm b/tests/typematch-tests.scm
index 6d5a3e57..243f11c6 100644
--- a/tests/typematch-tests.scm
+++ b/tests/typematch-tests.scm
@@ -1,8 +1,8 @@
 ;;;; typematch-tests.scm
 
 
-(use (only chicken.data-structures identity)
-     chicken.blob chicken.memory locative)
+(import (only chicken.data-structures identity)
+        chicken.blob chicken.memory locative)
 
 
 (define (make-list n x)
diff --git a/tests/version-tests.scm b/tests/version-tests.scm
index 9b98af46..6ba34ba1 100644
--- a/tests/version-tests.scm
+++ b/tests/version-tests.scm
@@ -1,4 +1,4 @@
-(use irregex chicken.platform chicken.string)
+(import irregex chicken.platform chicken.string)
 
 (let* ((version-tokens (string-split (chicken-version) "."))
        (major (string->number (car version-tokens)))
Trap