5 ms·
The program containing the declaration is unsound because it doesn't preclude using the variable in ways inconsistent with the declaration.
by hyperpape 9y ago
The program containing the declaration is unsound because it doesn't preclude using the variable in ways inconsistent with the declaration.
- lisper 9y agoAh. In that case: > that's not a type, since it is trivially unsound You are misunderstanding what a type is. A type is just a subset of all of the possible data values in a language. Types by themselves don't do anything.
- hyperpape 9y agoIt doesn't count as an assignment of a type to a variable because it's trivially unsound. Are you happy with the rewording?
- lisper 9y agoOK, but: 1. CL implementations are free to do static type analysis based on declarations (and some do) and they are also free to signal run-time errors if you assign a value not of the declared type (and some do). 2. Not all storage locations are variables, e.g.: Welcome to Clozure Common Lisp Version 1.10-r16479M (DarwinX8664)! ? (setf a (make-array 10 :element-type '(unsigned-byte 32))) #(0 0 0 0 0 0 0 0 0 0) ? (setf (aref a 0) 'foo) > Error: FOO doesn't match array element type of #<VECTOR 10 type (UNSIGNED-BYTE 32), simple>. The point is that focusing on "variables" makes tacit assumptions about programming languages that aren't necessarily true.