LINUX.ORG.RU

История изменений

Исправление SZT, (текущая версия) :

(declare (type ...)) даёт только оптимизацию и runtime asserts.

Почитай http://www.sbcl.org/manual/#Getting-Existing-Programs-to-Run по ссылке. Стандарт Common Lisp предусматривает декларации типов, которые некоторые реализации могут использовать также для статической проверки типов еще на этапе компиляции. Делать это или не делать - решают создатели конкретной реализации

Since SBCL’s compiler does much more comprehensive type checking than most Lisp compilers, SBCL may detect type errors in programs that have been debugged using other compilers. These errors are mostly incorrect declarations, although compile-time type errors can find actual bugs if parts of the program have never been tested.

Some incorrect declarations can only be detected by run-time type checking. It is very important to initially compile a program with full type checks (high safety optimization) and then test this safe version. After the checking version has been tested, then you can consider weakening or eliminating type checks. This applies even to previously debugged programs, because the SBCL compiler does much more type inference than other Common Lisp compilers, so an incorrect declaration can do more damage.

The most common problem is with variables whose constant initial value doesn’t match the type declaration. Incorrect constant initial values will always be flagged by a compile-time type error, and they are simple to fix once located. Consider this code fragment:

Исходная версия SZT, :

(declare (type ...)) даёт только оптимизацию и runtime asserts.

Почитай http://www.sbcl.org/manual/#Getting-Existing-Programs-to-Run по ссылке. Стандарт Common Lisp предусматривает декларации типов, которые некоторые реализации могут использовать также для статической проверки типов еще на этапе компиляции. Делать это или не делать - решают создатели конкретной реализации