Confused About Static Type Safety

I'm confused about StaticTypeSafety. First of all, I believe the people who like static typing should use it, and the people who don't like it shouldn't use it. But...

I thought the reason variables were typed was not to catch errors (i.e. that was a benefit, not a reason). I thought the reason variables were typed was they needed to be typed so you could write compilers.

I was taught in my first programming class that a variable is a box. If everything is an object all variable boxes can be shaped the same way - to hold an object. But if everything is not an object, each variable box must be custom shaped - to hold an integer, string, structure, float etc.. Without statically typed variables how can you have non-fully-OO and non-LISP languages?

Isn't catching programmer errors just a fortuitous side benefit?


if everything is an object (or a list like in LISP) Please don't post misinformation. Everything is NOT a list in Lisp. Built-in types include lists, arrays, functions, symbols, hash tables, etc. I think you are confusing the fact that the SYMBOL points to an OBJECT which may (or may not) be "boxed" (i.e. stored in multiple words of memory, some bits are which are used to store the type information). See CommonLisp or a fine reference manual before perpetuating myths. Thank you. --AlainPicard


CategoryLanguageTyping


EditText of this page (last edited May 14, 2004) or FindPage with title or text search