[fpc-devel] Could FPC add the PLM "based" construct?

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Nov 17 14:01:59 CET 2009


Micha Nelissen ha scritto:
> Giuliano Colla wrote:
>> Micha Nelissen ha scritto:
>>> Giuliano Colla wrote:
>>>> With "absolute" you need a) to declare an extra type (PByte, or 
>>>
>>> "Declaring an extra type" is one of those things that make Pascal 
>>> what it is; declaring before use.
>>
>> You mean that declaring "twice" is smarter than declaring just once?
> 
> You're actively trying to deceive me here? Nothing is declared "twice" 
> as in "two times", but the declaration is split in two pieces. Btw, 9 
> times out of 10 the type declaration is reused multiple times so in the 
> end it saves typing.
> 

I try to make myself more clear. Of course the "based" construct comes 
useful when you're dealing with structured data such as records. And of 
course you need a type declaration for your record. But currently you 
need a second type declaration for a pointer to that record. This is not 
  a split declaration, but an extra declaration.

>> one for the typed pointer itself. The Pascal type is visible in the 
>> pointer type declaration, and not in the pointer declaration (which is 
>> in a different section, var vs. type, which in a large program can be 
> 
> That's why names were invented in programming languages. Names can add 
> meaning to types. It can make the reader see structure instead of chaos.
> 

The record type name is meaningful, the pointer type name is not. The 
usual way is to use the same name of the record, prepended by a P. If it 
can be inferred from the structure name, it's pleonastic. If it can't 
it's obfuscating. The "based" construct makes it implicit.

>> It would be more consistent with the rest of the language, but what I 
>> suggest is to push consistency on the opposite direction.
> 
> The opposite direction is the wrong direction.
> 

I've never found the C++ way (Button->Click) more telling than FPC way 
(Button.Click), on the contrary I find it cumbersome, but of course 
you're free to think otherwise.

-- 
Giuliano Colla

Whenever people agree with me, I always feel I must be wrong (O. Wilde)



More information about the fpc-devel mailing list