Why static typed languages are sometimes better.

Heather Coppersmith me at privacy.net
Fri Jul 2 14:05:17 CEST 2004


On Fri, 02 Jul 2004 06:29:40 GMT,
"Mike Austin" <mike at mike-austin.com> wrote:

> There are dynamically typed language such as Dylan and CLOS that
> can put restrictions on what type of arguments are passed to
> functions, and fail if there is no match.  Although this is
> using a mechanism -- multimethods.  On that thought, are
> multimethods considered to be a form of type checking, or simply
> a mechanism? Hmm.

Is "Object Oriented Programming" a form of type checking, or
simply a mechanism?

Untested code:

    class A:
        def a( self ): print "A.a"

    class B:
        def a( self ): pass "B.a"

    class C:
        pass

    def foo( an_object ):
        an_object.a( )

    foo( A( ) )
    foo( B( ) )
    foo( C( ) )

For that matter, what about imperative programming and simple
binary operators?

    print "a" / 4.0

Previous pythons raised exceptions for this:

    print 2**24 * 2**24

Somewhere along the line, you must meet some minimum criteria for
using any given mechanism, and the mechanism itself may contain
"checking" of one kind or another.  If I load two CPU floating
point registers with "random garbage" (whatever that means) and
then try to multiply them together, but the CPU throws a floating
point exception, is that type checking?

Regards,
Heather

-- 
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli



More information about the Python-list mailing list