[fpc-pascal] Do you get type errors?

spir denis.spir at gmail.com
Sun Jun 20 14:35:54 CEST 2010


Hello,

Theoretically speaking, I'm all for type checking; and for programming discipline in general. But in practice I never get type errors. What the compiler complains about is all kinds of plain grammatical errors:
* typos
* missing ';' (many)
* wrong number of 'end'
* name error
* signature error (forgot to change proc/func declaration after editing definition)

But errors like the folllowing, never:
trial.pas(14,7) Error: Incompatible types: got "Extended" expected "LongInt"
[source:
program trial;
var
	n : Integer;
begin
	n := 1.1;
end.
]

The only kind of type error I get is when I forget to "cast back" a pointer from a pointer collection such as TFPList.

So, a few questions:
* Do you get type errors?
(playing the devil's advocate:)
* What is type checking _actually_ useful for? 
* What about a compiler without type-checking?

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com



More information about the fpc-pascal mailing list