Matthias Blume wrote: > Pascal Costanza <[EMAIL PROTECTED]> writes: > >> - In a dynamically typed language, you can run programs successfully >> that are not acceptable by static type systems. > > This statement is false.
The example I have given is more important than this statement. > For every program that can run successfully to completion there exists > a static type system which accepts that program. Moreover, there is > at least one static type system that accepts all such programs. > > What you mean is that for static type systems that are restrictive > enough to be useful in practice there always exist programs which > (after type erasure in an untyped setting, i.e., by switching to a > different language) would run to completion, but which are rejected by > the static type system. No, that's not what I mean. >> Here is an example in Common Lisp: >> >> ; A class "person" with no superclasses and with the only field "name": >> (defclass person () >> (name)) >> >> ; A test program: >> (defun test () >> (let ((p (make-instance 'person))) >> (eval (read)) >> (slot-value p 'address))) >> >> (slot-value p 'address) is an attempt to access the field 'address in >> the object p. In many languages, the notation for this is p.address. >> >> Although the class definition for person doesn't mention the field >> address, the call to (eval (read)) allows the user to change the >> definition of the class person and update its existing >> instances. Therefore at runtime, the call to (slot-value p 'adress) >> has a chance to succeed. > > I am quite comfortable with the thought that this sort of evil would > get rejected by a statically typed language. :-) This sort of feature is clearly not meant for you. ;-P Pascal -- 3rd European Lisp Workshop July 3 - Nantes, France - co-located with ECOOP 2006 http://lisp-ecoop06.bknr.net/ -- http://mail.python.org/mailman/listinfo/python-list