[fpc-pascal] Re: type declarations [was Re:]

listmember listmember at letterboxes.org
Sun May 29 20:11:04 CEST 2005

Florian Klaempfl wrote:

>>I am not sure it is one of those things that need not work.
> What would be the gain?

Unless the compiler generates some sort of hint, or warning;
the loss (i.e. negative gain) is a needlesly confused developer.

>>Interesting... this little bit of flexiblity would make
>>life that hard for the compiler?
> Well, don't forget that adding more flexibility could also be 
 > abused, if you example worked, why shouldn't
> type
>  pMyRec = ^tMyRec;
> var
>   i :longint;
> type
>   tMyRec = Record
>     data:pointer;
>     next:pMyRec;
>   end;
> work. 

IMHO it should work too :-)

After all, all these declarations are in the same unit, so we
do not have any namespace conflicts to worry about.

Is there any reason that forward declarations be immediately
above or below what they refer to?

> There is simply a limit in flexibility where it gives no extra
> gain anymore.

Should I understand this as something to do with the current
compiler being written from ground up; i.e. some features
will be added as the codebase matures?

>>So, these 2 different forms are theated differently by the
>>compiler too?
>>const SOME_NUMBER1 = 1;
>>const SOME_NUMBER2 = 2;
>>const SOME_NUMBER3 = 3;
>>const SOME_NUMBER4 = 4;
>>and this:
>>  SOME_NUMBER1 = 1;
>>  SOME_NUMBER2 = 2;
>>  SOME_NUMBER3 = 3;
>>  SOME_NUMBER4 = 4;
> Internally of course, the second is compiled faster, you won't 
 > notice it though in this example ;)

Yes, but both are allowed..


More information about the fpc-pascal mailing list