[fpc-pascal] Re:
Florian Klaempfl
F.Klaempfl at gmx.de
Sun May 29 14:05:58 CEST 2005
listmember wrote:
> Florian Klaempfl wrote:
>
>> It's simply the philosophy of pascal: things which need not to work
>> don't work. The extra type gives no gain, so why should be allowed?
>
>
> I am not sure it is one of those things that need not work.
What would be the gain?
>
> You could look at it from a different perspective: It does not
> add any ambiguity to anything at all. Why then disallow it.
See my reasons I gave earlier in this thread but there is no reason to
allow it.
>
> I mean, is there really a difference between this:
>
> type
> pMyRec = ^tMyRec;
>
> type
> tMyRec = Record
> data:pointer;
> next:pMyRec;
> end;
>
> and this:
>
> type
> pMyRec = ^tMyRec;
>
> tMyRec = Record
> data:pointer;
> next:pMyRec;
> end;
>
> especially since there isn't a different kind of declaration
> between the first 'type' and the second --and even if there were.
>
>> It makes
>
>> - reading the code harder
>> - work for the compiler harder => slower and more error prone compiler
>
>
> 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. There is simply a limit in flexibility where it gives no extra
gain anymore.
>
> So, these 2 different forms are theated differently by the
> compiler too?
>
> This:
>
> const SOME_NUMBER1 = 1;
> const SOME_NUMBER2 = 2;
> const SOME_NUMBER3 = 3;
> const SOME_NUMBER4 = 4;
>
> and this:
>
> const
> 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 ;)
More information about the fpc-pascal
mailing list