~ chicken-core (chicken-5) 91903231777f8d3bbb5e6a9c16d96c780be2f5ef


commit 91903231777f8d3bbb5e6a9c16d96c780be2f5ef
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Thu Dec 14 21:51:30 2017 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Dec 29 20:51:12 2017 +0100

    Remove obsolete/deprecated stuff
    
    This cleans up the mess of variables from "scheme" and "chicken.base"
    that were aliased at toplevel, as there should be nothing relying on
    that anymore.
    
    Also add some explicit (import scheme) to non-module files, because
    we're using -explicit-use to compile most files, this is required
    even though these are not inside a module.
    
    Finally, remove support for direct lambdas in define-syntax or
    let-syntax, in favour of requiring wrapped transformer objects as
    created by [ei]r-macro-transformer and syntax-rules.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/NEWS b/NEWS
index ff67301c..3a51fca0 100644
--- a/NEWS
+++ b/NEWS
@@ -88,6 +88,8 @@
 - Syntax expander
   - Removed support for (define-syntax (foo e r c) ...), which was
     undocumented and not officially supported anyway.
+  - Removed support for normal "lambda" forms as syntax transformers,
+    which has been deprecated since 4.8.0.
   - define and friends are now aggressively rejected in "expression
     contexts" (i.e., anywhere but toplevel or as internal defines).
   - define-record and define-record-type now create record types
diff --git a/chicken-ffi-syntax.scm b/chicken-ffi-syntax.scm
index 255c9c93..f628723f 100644
--- a/chicken-ffi-syntax.scm
+++ b/chicken-ffi-syntax.scm
@@ -36,7 +36,8 @@
   (no-bound-checks)
   (no-procedure-checks))
 
-(import chicken.base
+(import scheme
+	chicken.base
 	chicken.format
 	chicken.internal
 	chicken.platform
diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index 715e45d3..4801431c 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -39,7 +39,7 @@
   (no-bound-checks)
   (no-procedure-checks))
 
-(import chicken (chicken internal))
+(import chicken scheme (chicken internal))
 
 (include "common-declarations.scm")
 (include "mini-srfi-1.scm")
diff --git a/chicken.base.import.scm b/chicken.base.import.scm
index de53c9e8..28c0dc3b 100644
--- a/chicken.base.import.scm
+++ b/chicken.base.import.scm
@@ -96,7 +96,4 @@
    (vector-resize . chicken.base#vector-resize)
    (void . chicken.base#void)
    (warning . chicken.base#warning))
- ;; OBSOLETE: This can be removed after bootstrapping
- (if (##sys#symbol-has-toplevel-binding? '##sys#chicken.base-macro-environment)
-     ##sys#chicken.base-macro-environment
-     ##sys#chicken-macro-environment))
+ ##sys#chicken.base-macro-environment)
diff --git a/chicken.h b/chicken.h
index 8005bec3..5fa8a8cd 100644
--- a/chicken.h
+++ b/chicken.h
@@ -2146,13 +2146,6 @@ C_mutate(C_word *slot, C_word val)
   else return *slot = val;
 }
 
-inline static C_word
-C_mutate2(C_word *slot, C_word val) /* OBSOLETE */
-{
-  if(!C_immediatep(val)) return C_mutate_slot(slot, val);
-  else return *slot = val;
-}
-
 inline static C_word C_permanentp(C_word x)
 {
   return C_mk_bool(!C_immediatep(x) &&
diff --git a/chicken.import.scm b/chicken.import.scm
index 41b5ace6..610cfe38 100644
--- a/chicken.import.scm
+++ b/chicken.import.scm
@@ -23,14 +23,6 @@
 ; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 ; POSSIBILITY OF SUCH DAMAGE.
 
-;; OBSOLETE: This can be removed after bootstrapping (needed for
-;; macros and constant evaluation in compiler)
-(if (not (##sys#symbol-has-toplevel-binding? 'chicken.base#add1))
-    (begin
-      (set! chicken.base#add1 add1)
-      (set! chicken.base#sub1 sub1)
-      (set! chicken.base#symbol-append symbol-append)))
-
 (##sys#register-primitive-module
  'chicken
  '((abort . chicken.condition#abort)
diff --git a/chicken.syntax.import.scm b/chicken.syntax.import.scm
index 12120427..1302e008 100644
--- a/chicken.syntax.import.scm
+++ b/chicken.syntax.import.scm
@@ -36,7 +36,4 @@
    (syntax-error . chicken.syntax#syntax-error)
    (er-macro-transformer . chicken.syntax#er-macro-transformer)
    (ir-macro-transformer . chicken.syntax#ir-macro-transformer))
- ;; OBSOLETE: This can be removed after bootstrapping
- (if (##sys#symbol-has-toplevel-binding? '##sys#chicken.syntax-macro-environment)
-     ##sys#chicken.syntax-macro-environment
-     ##sys#chicken-macro-environment))
+ ##sys#chicken.syntax-macro-environment)
diff --git a/csi.scm b/csi.scm
index ad4b170d..3d1140ab 100644
--- a/csi.scm
+++ b/csi.scm
@@ -988,7 +988,6 @@ EOF
 	   (program-name (cadr script))
 	   (command-line-arguments (cddr script))
 	   ;; 2012-10-04 (felix) left 'script activated to avoid breaking too much code
-	   (register-feature! 'script)	; DEPRECATED
 	   (register-feature! 'chicken-script)
 	   (set-cdr! (cdr script) '()) 
 	   (when ##sys#windows-platform
diff --git a/eval.scm b/eval.scm
index 418875d1..0d577c0d 100644
--- a/eval.scm
+++ b/eval.scm
@@ -866,11 +866,6 @@
 	  'null-environment
 	  "unsupported null environment version" n))))))
 
-
-;;; OBSOLETE: Remove after bootstrapping.  Import libraries emitted by
-;;; old compilers will still refer to chicken.eval#eval.
-(define chicken.eval#eval scheme#eval)
-
 ) ; eval module
 
 
@@ -1374,11 +1369,6 @@
 					fname) ) )
 		  (else (loop (##sys#slot paths 1))) ) ) ) ) ) )
 
-;;; OBSOLETE: Remove after bootstrapping.  Import libraries loaded
-;;; from an old compiler's library path will still refer to
-;;; chicken.load#load in their compiled module registration code.
-(define chicken.load#load scheme#load)
-
 ) ; chicken.load
 
 
diff --git a/expand.scm b/expand.scm
index 9b837bb8..ca9ba693 100644
--- a/expand.scm
+++ b/expand.scm
@@ -178,9 +178,9 @@
 (define ##sys#chicken.base-macro-environment '()) ; used later in chicken.base.import.scm
 
 (define (##sys#ensure-transformer t #!optional loc)
-  (cond ((procedure? t) (##sys#slot (##sys#er-transformer t) 1)) ; DEPRECATED
-	((##sys#structure? t 'transformer) (##sys#slot t 1))
-	(else (##sys#error loc "expected syntax-transformer, but got" t))))
+  (if (##sys#structure? t 'transformer)
+      (##sys#slot t 1)
+      (##sys#error loc "expected syntax-transformer, but got" t)))
 
 (define (##sys#extend-macro-environment name se transformer)
   (let ((me (##sys#macro-environment))
@@ -961,7 +961,7 @@
 
 ) ; chicken.syntax module
 
-(import chicken chicken.blob chicken.syntax chicken.internal)
+(import scheme chicken chicken.blob chicken.syntax chicken.internal)
 
 ;;; Macro definitions:
 
diff --git a/library.scm b/library.scm
index 221a43b8..b81bee8f 100644
--- a/library.scm
+++ b/library.scm
@@ -5068,9 +5068,6 @@ EOF
    (lambda ()
      (cleanup-before-exit))))
 
-;; OBSOLETE: remove after bootstrapping
-(define ##sys#implicit-exit-handler chicken.base#implicit-exit-handler)
-
 (define ##sys#reset-handler ; Exposed by chicken.repl
   (make-parameter
    (lambda ()
@@ -6463,203 +6460,3 @@ EOF
   (##core#primitive "C_return_to_host"))
 
 ) ; chicken.platform
-
-
-
-;;; OBSOLETE: Remove after bootstrapping.  This ensures the unprefixed
-;;; names are still bound to the correct definitions, because "scheme"
-;;; in the bootstrapping compiler's modules.scm may still refer to
-;;; them by the unprefixed name.
-(##sys#setslot 'not 0 scheme#not)
-(##sys#setslot 'boolean? 0 scheme#boolean?)
-(##sys#setslot 'eq? 0 scheme#eq?)
-(##sys#setslot 'eqv? 0 scheme#eqv?)
-(##sys#setslot 'equal? 0 scheme#equal?)
-(##sys#setslot 'pair? 0 scheme#pair?)
-(##sys#setslot 'cons 0 scheme#cons)
-(##sys#setslot 'car 0 scheme#car)
-(##sys#setslot 'cdr 0 scheme#cdr)
-(##sys#setslot 'caar 0 scheme#caar)
-(##sys#setslot 'cadr 0 scheme#cadr)
-(##sys#setslot 'cdar 0 scheme#cdar)
-(##sys#setslot 'cddr 0 scheme#cddr)
-(##sys#setslot 'caaar 0 scheme#caaar)
-(##sys#setslot 'caadr 0 scheme#caadr)
-(##sys#setslot 'cadar 0 scheme#cadar)
-(##sys#setslot 'caddr 0 scheme#caddr)
-(##sys#setslot 'cdaar 0 scheme#cdaar)
-(##sys#setslot 'cdadr 0 scheme#cdadr)
-(##sys#setslot 'cddar 0 scheme#cddar)
-(##sys#setslot 'cdddr 0 scheme#cdddr)
-(##sys#setslot 'caaaar 0 scheme#caaaar)
-(##sys#setslot 'caaadr 0 scheme#caaadr)
-(##sys#setslot 'caadar 0 scheme#caadar)
-(##sys#setslot 'caaddr 0 scheme#caaddr)
-(##sys#setslot 'cadaar 0 scheme#cadaar)
-(##sys#setslot 'cadadr 0 scheme#cadadr)
-(##sys#setslot 'caddar 0 scheme#caddar)
-(##sys#setslot 'cadddr 0 scheme#cadddr)
-(##sys#setslot 'cdaaar 0 scheme#cdaaar)
-(##sys#setslot 'cdaadr 0 scheme#cdaadr)
-(##sys#setslot 'cdadar 0 scheme#cdadar)
-(##sys#setslot 'cdaddr 0 scheme#cdaddr)
-(##sys#setslot 'cddaar 0 scheme#cddaar)
-(##sys#setslot 'cddadr 0 scheme#cddadr)
-(##sys#setslot 'cdddar 0 scheme#cdddar)
-(##sys#setslot 'cddddr 0 scheme#cddddr)
-(##sys#setslot 'set-car! 0 scheme#set-car!)
-(##sys#setslot 'set-cdr! 0 scheme#set-cdr!)
-(##sys#setslot 'null? 0 scheme#null?)
-(##sys#setslot 'list? 0 scheme#list?)
-(##sys#setslot 'list 0 scheme#list)
-(##sys#setslot 'length 0 scheme#length)
-(##sys#setslot 'list-tail 0 scheme#list-tail)
-(##sys#setslot 'list-ref 0 scheme#list-ref)
-(##sys#setslot 'append 0 scheme#append)
-(##sys#setslot 'reverse 0 scheme#reverse)
-(##sys#setslot 'memq 0 scheme#memq)
-(##sys#setslot 'memv 0 scheme#memv)
-(##sys#setslot 'member 0 scheme#member)
-(##sys#setslot 'assq 0 scheme#assq)
-(##sys#setslot 'assv 0 scheme#assv)
-(##sys#setslot 'assoc 0 scheme#assoc)
-(##sys#setslot 'symbol? 0 scheme#symbol?)
-(##sys#setslot 'symbol->string 0 scheme#symbol->string)
-(##sys#setslot 'string->symbol 0 scheme#string->symbol)
-(##sys#setslot 'number? 0 scheme#number?)
-(##sys#setslot 'integer? 0 scheme#integer?)
-(##sys#setslot 'exact? 0 scheme#exact?)
-(##sys#setslot 'real? 0 scheme#real?)
-(##sys#setslot 'complex? 0 scheme#complex?)
-(##sys#setslot 'inexact? 0 scheme#inexact?)
-(##sys#setslot 'rational? 0 scheme#rational?)
-(##sys#setslot 'zero? 0 scheme#zero?)
-(##sys#setslot 'odd? 0 scheme#odd?)
-(##sys#setslot 'even? 0 scheme#even?)
-(##sys#setslot 'positive? 0 scheme#positive?)
-(##sys#setslot 'negative? 0 scheme#negative?)
-(##sys#setslot 'max 0 scheme#max)
-(##sys#setslot 'min 0 scheme#min)
-(##sys#setslot '+ 0 scheme#+)
-(##sys#setslot '- 0 scheme#-)
-(##sys#setslot '* 0 scheme#*)
-(##sys#setslot '/ 0 scheme#/)
-(##sys#setslot '= 0 scheme#=)
-(##sys#setslot '> 0 scheme#>)
-(##sys#setslot '< 0 scheme#<)
-(##sys#setslot '>= 0 scheme#>=)
-(##sys#setslot '<= 0 scheme#<=)
-(##sys#setslot 'quotient 0 scheme#quotient)
-(##sys#setslot 'remainder 0 scheme#remainder)
-(##sys#setslot 'modulo 0 scheme#modulo)
-(##sys#setslot 'gcd 0 scheme#gcd)
-(##sys#setslot 'lcm 0 scheme#lcm)
-(##sys#setslot 'abs 0 scheme#abs)
-(##sys#setslot 'floor 0 scheme#floor)
-(##sys#setslot 'ceiling 0 scheme#ceiling)
-(##sys#setslot 'truncate 0 scheme#truncate)
-(##sys#setslot 'round 0 scheme#round)
-(##sys#setslot 'rationalize 0 scheme#rationalize)
-(##sys#setslot 'exact->inexact 0 scheme#exact->inexact)
-(##sys#setslot 'inexact->exact 0 scheme#inexact->exact)
-(##sys#setslot 'exp 0 scheme#exp)
-(##sys#setslot 'log 0 scheme#log)
-(##sys#setslot 'expt 0 scheme#expt)
-(##sys#setslot 'sqrt 0 scheme#sqrt)
-(##sys#setslot 'sin 0 scheme#sin)
-(##sys#setslot 'cos 0 scheme#cos)
-(##sys#setslot 'tan 0 scheme#tan)
-(##sys#setslot 'asin 0 scheme#asin)
-(##sys#setslot 'acos 0 scheme#acos)
-(##sys#setslot 'atan 0 scheme#atan)
-(##sys#setslot 'number->string 0 scheme#number->string)
-(##sys#setslot 'string->number 0 scheme#string->number)
-(##sys#setslot 'char? 0 scheme#char?)
-(##sys#setslot 'char=? 0 scheme#char=?)
-(##sys#setslot 'char>? 0 scheme#char>?)
-(##sys#setslot 'char<? 0 scheme#char<?)
-(##sys#setslot 'char>=? 0 scheme#char>=?)
-(##sys#setslot 'char<=? 0 scheme#char<=?)
-(##sys#setslot 'char-ci=? 0 scheme#char-ci=?)
-(##sys#setslot 'char-ci<? 0 scheme#char-ci<?)
-(##sys#setslot 'char-ci>? 0 scheme#char-ci>?)
-(##sys#setslot 'char-ci>=? 0 scheme#char-ci>=?)
-(##sys#setslot 'char-ci<=? 0 scheme#char-ci<=?)
-(##sys#setslot 'char-alphabetic? 0 scheme#char-alphabetic?)
-(##sys#setslot 'char-whitespace? 0 scheme#char-whitespace?)
-(##sys#setslot 'char-numeric? 0 scheme#char-numeric?)
-(##sys#setslot 'char-upper-case? 0 scheme#char-upper-case?)
-(##sys#setslot 'char-lower-case? 0 scheme#char-lower-case?)
-(##sys#setslot 'char-upcase 0 scheme#char-upcase)
-(##sys#setslot 'char-downcase 0 scheme#char-downcase)
-(##sys#setslot 'char->integer 0 scheme#char->integer)
-(##sys#setslot 'integer->char 0 scheme#integer->char)
-(##sys#setslot 'string? 0 scheme#string?)
-(##sys#setslot 'string=? 0 scheme#string=?)
-(##sys#setslot 'string>? 0 scheme#string>?)
-(##sys#setslot 'string<? 0 scheme#string<?)
-(##sys#setslot 'string>=? 0 scheme#string>=?)
-(##sys#setslot 'string<=? 0 scheme#string<=?)
-(##sys#setslot 'string-ci=? 0 scheme#string-ci=?)
-(##sys#setslot 'string-ci<? 0 scheme#string-ci<?)
-(##sys#setslot 'string-ci>? 0 scheme#string-ci>?)
-(##sys#setslot 'string-ci>=? 0 scheme#string-ci>=?)
-(##sys#setslot 'string-ci<=? 0 scheme#string-ci<=?)
-(##sys#setslot 'make-string 0 scheme#make-string)
-(##sys#setslot 'string-length 0 scheme#string-length)
-(##sys#setslot 'string-ref 0 scheme#string-ref)
-(##sys#setslot 'string-set! 0 scheme#string-set!)
-(##sys#setslot 'string-append 0 scheme#string-append)
-(##sys#setslot 'string-copy 0 scheme#string-copy)
-(##sys#setslot 'string->list 0 scheme#string->list)
-(##sys#setslot 'list->string 0 scheme#list->string)
-(##sys#setslot 'substring 0 scheme#substring)
-(##sys#setslot 'string-fill! 0 scheme#string-fill!)
-(##sys#setslot 'vector? 0 scheme#vector?)
-(##sys#setslot 'make-vector 0 scheme#make-vector)
-(##sys#setslot 'vector-ref 0 scheme#vector-ref)
-(##sys#setslot 'vector-set! 0 scheme#vector-set!)
-(##sys#setslot 'string 0 scheme#string)
-(##sys#setslot 'vector 0 scheme#vector)
-(##sys#setslot 'vector-length 0 scheme#vector-length)
-(##sys#setslot 'vector->list 0 scheme#vector->list)
-(##sys#setslot 'list->vector 0 scheme#list->vector)
-(##sys#setslot 'vector-fill! 0 scheme#vector-fill!)
-(##sys#setslot 'procedure? 0 scheme#procedure?)
-(##sys#setslot 'map 0 scheme#map)
-(##sys#setslot 'for-each 0 scheme#for-each)
-(##sys#setslot 'apply 0 scheme#apply)
-(##sys#setslot 'force 0 scheme#force)
-(##sys#setslot 'call-with-current-continuation 0 scheme#call-with-current-continuation)
-(##sys#setslot 'input-port? 0 scheme#input-port?)
-(##sys#setslot 'output-port? 0 scheme#output-port?)
-(##sys#setslot 'current-input-port 0 scheme#current-input-port)
-(##sys#setslot 'current-output-port 0 scheme#current-output-port)
-(##sys#setslot 'call-with-input-file 0 scheme#call-with-input-file)
-(##sys#setslot 'call-with-output-file 0 scheme#call-with-output-file)
-(##sys#setslot 'open-input-file 0 scheme#open-input-file)
-(##sys#setslot 'open-output-file 0 scheme#open-output-file)
-(##sys#setslot 'close-input-port 0 scheme#close-input-port)
-(##sys#setslot 'close-output-port 0 scheme#close-output-port)
-(##sys#setslot 'read 0 scheme#read)
-(##sys#setslot 'read-char 0 scheme#read-char)
-(##sys#setslot 'peek-char 0 scheme#peek-char)
-(##sys#setslot 'write 0 scheme#write)
-(##sys#setslot 'display 0 scheme#display)
-(##sys#setslot 'write-char 0 scheme#write-char)
-(##sys#setslot 'newline 0 scheme#newline)
-(##sys#setslot 'eof-object? 0 scheme#eof-object?)
-(##sys#setslot 'with-input-from-file 0 scheme#with-input-from-file)
-(##sys#setslot 'with-output-to-file 0 scheme#with-output-to-file)
-(##sys#setslot 'char-ready? 0 scheme#char-ready?)
-(##sys#setslot 'imag-part 0 scheme#imag-part)
-(##sys#setslot 'real-part 0 scheme#real-part)
-(##sys#setslot 'make-rectangular 0 scheme#make-rectangular)
-(##sys#setslot 'make-polar 0 scheme#make-polar)
-(##sys#setslot 'angle 0 scheme#angle)
-(##sys#setslot 'magnitude 0 scheme#magnitude)
-(##sys#setslot 'numerator 0 scheme#numerator)
-(##sys#setslot 'denominator 0 scheme#denominator)
-(##sys#setslot 'dynamic-wind 0 scheme#dynamic-wind)
-(##sys#setslot 'values 0 scheme#values)
-(##sys#setslot 'call-with-values 0 scheme#call-with-values)
diff --git a/modules.scm b/modules.scm
index 4e29e718..9241958a 100644
--- a/modules.scm
+++ b/modules.scm
@@ -34,11 +34,6 @@
 	mark-imported-symbols match-functor-argument merge-se
 	module-indirect-exports module-rename register-undefined))
 
-(include "common-declarations.scm")
-(include "mini-srfi-1.scm")
-
-(define-syntax d (syntax-rules () ((_ . _) (void))))
-
 (import scheme
 	chicken.base
 	chicken.internal
@@ -46,6 +41,11 @@
 	chicken.platform
 	chicken.syntax)
 
+(include "common-declarations.scm")
+(include "mini-srfi-1.scm")
+
+(define-syntax d (syntax-rules () ((_ . _) (void))))
+
 (define-alias dd d)
 (define-alias dm d)
 (define-alias dx d)
diff --git a/profiler.scm b/profiler.scm
index 3ec52c1d..ea371d9f 100644
--- a/profiler.scm
+++ b/profiler.scm
@@ -31,7 +31,7 @@
   (unsafe)
   (disable-interrupts))
 
-(import chicken)
+(import chicken.base chicken.fixnum scheme)
 
 (include "common-declarations.scm")
 
diff --git a/scheduler.scm b/scheduler.scm
index a6440001..220e0a81 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -133,7 +133,7 @@ inline static void C_fdset_add(int fd, int input, int output) {
 EOF
 ) )
 
-(import chicken chicken.format)
+(import scheme chicken chicken.format)
 
 (include "common-declarations.scm")
 
diff --git a/tests/compiler-tests.scm b/tests/compiler-tests.scm
index bd150fe2..54bda8b4 100644
--- a/tests/compiler-tests.scm
+++ b/tests/compiler-tests.scm
@@ -367,11 +367,12 @@
 ;; #1059: foreign vector types use wrong lolevel accessors, causing
 ;; paranoid DEBUGBUILD assertions to fail.
 (define-syntax srfi-4-vector-length
-  (lambda (e r c)
-    (let* ((type (symbol->string (strip-syntax (cadr e))))
-           (base-type (string-translate* type '(("nonnull-" . ""))))
-           (length-procedure-name (string-append base-type "-length")))
-     `(,(string->symbol length-procedure-name) ,(caddr e)))))
+  (er-macro-transformer
+   (lambda (e r c)
+     (let* ((type (symbol->string (strip-syntax (cadr e))))
+	    (base-type (string-translate* type '(("nonnull-" . ""))))
+	    (length-procedure-name (string-append base-type "-length")))
+       `(,(string->symbol length-procedure-name) ,(caddr e))))))
 
 (define-syntax s4v-sum
   (syntax-rules ()
Trap