e:)
* What is type checking _actually_ useful for?

I would be lost without type checking,
especially when using sophisticated data structures
like pointers to arrays of records (which again
contain pointers to other complex structures).
An example:

type  ArrayType = array[1..10] of SomeType;
     PointType = ^ArrayType;
var   X : PointType;
     Y : SomeType;

What happens if you forget a dereferencing ^ in an expression like this:

Y := X[7]

where it should have been

Y := X^[7]

What does the compiler do without type checking
in the first case? Does it access X as if it
was an array (of what element type/size?).

It often happens that I change a type into a
pointer to that type. Then I expect that the
compiler shows me all places where I now get
a syntax error so that I can change the code
instead of having the compiler "guessing"
some meaning (that I may not have intended).

I also often change a string type into an integer
and vice versa. That implies a lot of code changes.
Again with type checking I can lean back and
rely on that the compiler will show me all places
where these changes are needed.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to