hello guys,
I have come across something in Pascal (FPC), when I started again using more and more OOP.
This is, I have to say, a critic point in FPC, which bases on the structure of modules, like:
functions/procedures, record, classes, units.
More detailed: I would actually love to see that Pascal
enforces the developer to write code in the same way, so to speak: Lets say this:
In my head, there shouldnt even be a need for a modeswitch to advanced records, it should be implicitly possibly
TSomeData = record
{here in my head, fpc should enforce the visibility section!}
public/private/strict private/protected etc...
Type
T1 = ....
T2 = ....
T3 = ....
const
C1 = ..
C2 = ...
var
V1: T1;
V2: T2;
end;
//this unfortunately, is not enforced so I can also just write all that without the enforced visibilty section, so it is
implicitly guest as public which I dont see it as pascalish way, since pascal wants more and clear expression of what u are trying to archieve. So if u want public, fine, then write it also so, like be forced to name the visibilty section. I dont know, I really find these types of enforcements very useful and readable.
Another thing is, as PascalDragon once suggested me to do with my generic stuff is:
type
generic TMultiSet<T> = record
public type //why the extra "public type" here
PMultiSet = ^specialize TMultiSet<T>;
public
fField: Byte;
value: PMultiSet;
end;
This example could also kinda show, that a good structural layout enforcement is really valuable, since saying:
type
generic TMultiSet<T> = record
public
type
PMultiSet = ^specialize TMultiSet<T>;
var
fField: Byte;
value: PMultiSet;
end;
follows the same layout-tree-enforcement everywhere or for instance I am also sadly able to just say:
generic TMultiSet<T> = record
private //note the missing "var" section
fField: Byte;
value: PMultiSet;
end;
These things, and I am not joking now, prevented 2 of my best friends from joining FPC and moving from C even tho they were looking for change, since C is to much of an old-burden for them, both of my friends participated largely in the Cafu Engine development and they kinda liked the overall Idea of FPC/Delphi, so both know C kinda good I wiould assume.
Would like to hear about that, if its something for you to consider or If I should consume less drugs :---D
Best regards
Shpend