Am 14.04.2019 um 04:07 schrieb Ben Grasset:
I dunno about setting them globally, but generally I do find
modeswitches rather annoying, as the combination of features is pretty
arbitrary, and they mostly just *disallow* things that couldn't break
the code of people who weren't using those features to begin with if
they were allowed.
E.G, I sincerely doubt that anybody has *ever* thought, "man, I sure
am glad that {$mode ObjFPC} does not allowed advanced records. It
would be specifically bad if it did!" because it just doesn't matter
if they weren't using advanced records to start with. It's just a lot
of minor rules that nobody can really explain but that tend to add up
in relatively annoying ways.
The thing is that we do try to be backwards compatible and thus rather
conservative with mode ObjFPC. E.g. the following code compiles without
the modeswitch set, but not with:
=== code begin ===
program tmw;
{$mode objfpc}
type
TTest = record
private: LongInt;
public: LongInt;
protected: LongInt;
strict: Longint;
end;
begin
end.
=== code end ===
This hasn't always been done optimally in the past, e.g. when I added
class helper support back in '12 or so I didn't protect the changes
behind a modeswitch. Something I would not do today.
Also the modeswitch itself is definitely required as definitely not all
language modes should support advanced records by default (e.g. TP or ISO).
Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal