Slashdot Mirror


Guido van Rossum On Strong vs. Weak Typing

Bill Venners writes "In this interview, Java creator James Gosling says, 'There's a folk theorem out there that systems with very loose typing are very easy to build prototypes with. That may be true. But the leap from a prototype built that way to a real industrial strength system is pretty vast.' In this interview, Python creator Guido van Rossum responds with 'That attitude sounds like the classic thing I've always heard from strong-typing proponents. The one thing that troubles me is that all the focus is on the strong typing, as if once your program is type correct, it has no bugs left. Strong typing catches many bugs, but it also makes you focus too much on getting the types right and not enough on getting the rest of the program correct.'"

4 of 100 comments (clear)

  1. More discussion by (a*2)+(ron) · · Score: 5, Informative


    Check out the recent discussions on lambda the ultimate (a programming languages weblog).

  2. Some helpful distinctions by Phouk · · Score: 4, Informative

    Here are some totally unscientific definitions, use at your own risk:

    Static typing: Both variables and objects have types. Type checking happens both at compile time and run time.

    Dynamic typing: Variables don't have types, but objects do. Type checking happens at run time.

    Strong typing: Strict and effective type checks; a string is a string and not a number. Often confused with static typing.

    Weak typing: Absent or ineffective type checks. E.g.: everything is a string, or everything is a pointer. Thus, a string could be used as a number or the other way round. Often confused with dynamic typing.

    Python, for example, has strong but dynamic typing.

    BTW, if you haven't seriously tried a dynamically typed language yet, maybe you should - they are simply much more fun, IMHO.

    --
    Stupidity is mis-underestimated.
    1. Re:Some helpful distinctions by AJWM · · Score: 4, Informative

      Think of it this way: the variable is just a (named) bucket that can hold stuff, objects are the stuff that sometimes goes in the buckets (and sometimes is just pointed to by something in a bucket, etc.)

      If you put a Foo object in bucket 'bar', it will still be a Foo object when you take it out, so (in a strongly typed language) you'd better be expecting a Foo. But when you're done with the Foo, you can put a Baz object in that bucket 'bar'.

      The bucket doesn't have a type, the object in the bucket does.

      --
      -- Alastair
    2. Re:Some helpful distinctions by Anonymous Coward · · Score: 1, Informative

      Actually, I would not say that in purely statically typed languages that objects have types, or that type checking happens at run time. Languages like C++ are not purely statically typed (anymore...).

      Strong/weak and Static/Dynamic are orthogonal axes.

      Strong/Weak is how rigorously typing is enforced. Static/Dynamic is when it happens.

      Strong Dynamic typing: Scheme, Lisp*

      Weak Dynamic typing: Perl5 (no, really, test it, it's scary - worst of both worlds!)

      Strong Static typing: ML family languages

      Weak Static typing: C

      "Typeless" or operator-typed languages: Assembly, Forth. In these languages, looking at them positively, types are associated with operators (eg. (asm) mov.l, mov.w, mov.b, (forth) F+, +), or, more negatively, types are irrelevant.

      * Note that Common Lisp has optional Weak and Strong Static typing.