~ chicken-core (chicken-5) f54fd27aa740b98b4848ed1c2676fed72ee77ffb


commit f54fd27aa740b98b4848ed1c2676fed72ee77ffb
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Tue May 10 07:47:57 2011 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue May 10 07:47:57 2011 +0200

    strict-types declaration

diff --git a/batch-driver.scm b/batch-driver.scm
index 956a0cff..2d663196 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -263,7 +263,9 @@
       (symbol-escape #f) )
     (set! verbose-mode verbose)
     (set! strict-variable-types (memq 'strict-types options))
-    (when strict-variable-types (set! enable-specialization #t))
+    (when strict-variable-types
+      (set! enable-specialization #t)
+      (set! do-scrutinize #t))
     (set! ##sys#read-error-with-line-number #t)
     (set! ##sys#include-pathnames
       (append (map chop-separator (collect-options 'include-path))
@@ -535,7 +537,7 @@
 			(load-inline-file ilf) )
 		      ifs)))
 
-		 (when (or strict-variable-types do-scrutinize enable-specialization)
+		 (when (or do-scrutinize enable-specialization)
 		   ;;XXX hardcoded database file name
 		   (unless (memq 'ignore-repository options)
 		     (load-type-database "types.db"))
diff --git a/compiler.scm b/compiler.scm
index 6494cdf9..53d0d896 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -71,6 +71,7 @@
 ; (unsafe)
 ; (unused <symbol> ...)
 ; (uses {<unitname>})
+; (strict-types)
 ; (specialize)
 ;
 ;   <type> = fixnum | generic
@@ -1524,6 +1525,8 @@
 	 (globalize-all (cdr spec))))
        ((specialize)
 	(set! enable-specialization #t))
+       ((strict-types)
+	(set! strict-variable-types #t))
        (else (warning "unknown declaration specifier" spec)) )
      '(##core#undefined) ) ) )
 
diff --git a/manual/Declarations b/manual/Declarations
index c6af35d4..6ebc8268 100644
--- a/manual/Declarations
+++ b/manual/Declarations
@@ -264,7 +264,7 @@ procedures.
 Enables scrutiny. This is equivalent to passing the {{-scrutinize}} option to the compiler.
 
 
-=== specializat
+=== specialize
 
  [declaration specifier] (specialize)
 
@@ -282,6 +282,13 @@ then all but the given standard bindings are assumed to be never
 redefined.
 
 
+=== strict-types
+
+ [declaration specifier] (strict-types)
+
+Declares that the type of variables is not changed by assignment. Equivalent to giving the {{-strict-types}} compiler option.
+
+
 === type
 
   [declaration specifier] (type (SYMBOL TYPE) ...)
diff --git a/manual/Using the compiler b/manual/Using the compiler
index 31334746..284c0c3b 100644
--- a/manual/Using the compiler	
+++ b/manual/Using the compiler	
@@ -159,7 +159,7 @@ the source text should be read from standard input.
 
 ; -static-extension NAME : similar to {{-require-extension NAME}}, but links extension statically (also applies for an explicit {{(require-extension NAME)}}).
 
-; -strict-types : Assume that the type of variables does not change because of assignments. This gives more type-information during specialization, but violating this assumption will result in unsafe and incorrectly behaving code.
+; -strict-types : Assume that the type of variables is not changed by assignments. This gives more type-information during specialization, but violating this assumption will result in unsafe and incorrectly behaving code.
 
 ; -types FILENAME : load additional type database from {{FILENAME}}. Type-definitions in {{FILENAME}} will override previous type-definitions.
 
Trap