Name: Anonymous 2009-10-22 15:39
Many languages such as Java and C use what is known as strong or static variable typing. This means that when you declare a variable in your application code you must define the variable type.
Fixnum and read it back as a String. In C, you can write an int and read it back as a char * with minimal hassle, making C a weakly typed language.CHECK-TYPE macro which just expands to:
(check-type place typespec)
== (assert (typep place 'typespec) (place)
'type-error :datum place :expected-type 'typespec)
CHECK-TYPE in SBCL, this is what they use signal the error and establish the restart:
(defun check-type-error (place place-value type type-string)
(let ((condition
(make-condition
'simple-type-error
:datum place-value
:expected-type type
:format-control
"The value of ~S is ~S, which is not ~:[of type ~S~;~:*~A~]."
:format-arguments (list place place-value type-string type))))
(restart-case (error condition)
(store-value (value)
:report (lambda (stream)
(format stream "Supply a new value for ~S." place))
:interactive read-evaluated-form
value))))CHECK-TYPE instance would expand to a DO loop which calls that function I pasted until the type is correct (or the code exits non-locally).