[fpc-devel] WTF? Type checking dependent on compilation mode!?

John Briggs john at johneb47.id.au
Wed Apr 27 00:24:06 CEST 2005


On Tue, Apr 26, 2005 at 10:47:16AM -0400, Angelo Bertolli wrote:
> I usually don't say anything, but I wanted to throw my opinion on this 
> as well.  This is important to me as someone who likes Pascal as a 
> learning tool (teaching tool), and as a language which adheres to 
> certain ideals.  I use FPC in standard mode--is it still going to let me 
> mix types like that?  If so, I'd like to see the type checking to be 
> stronger too.  I think it's ok to allow switches to turn this off, but 
> FP should be Pascal by default.
> 
I agree with you Angelo. I would have responded to the thread earlier but I 
decided to do some research first by investigating the ISO 7185 Standard 
Pascal. IMHO we need to adhere to standard as much as possible and strong 
type checking is an integral part of the standard. 

I do not agree with Florian's comment:
 "It's simply a thing to make life easier especially for beginners."

Like Vinzent I can number many reasons why arrays should not be considered 
equal.

Arrays can be considered equal iff they are declared the same type eg.:

type
   tA, tB = array[0..5] of byte;

var 
  A : tA;
  B : tB;
   ...

begin
	....
    B := A;      // valid assignment

and not equal if:

type
   tA = array[0..5] of byte;
   tB = array[0..5] of byte;

var
   A : tA;
   B : tB;
   ...

begin
	....
    B := A;      // invalid assignment

In the second case the two arrays maybe equal but iff the data are compared 
for equality.

Regards

John 




More information about the fpc-devel mailing list