[fpc-pascal] class operator in record

Sven Barth pascaldragon at googlemail.com
Wed Mar 1 11:20:58 CET 2017


Am 01.03.2017 10:06 schrieb "Graeme Geldenhuys" <
mailinglists at geldenhuys.co.uk>:
>
> On 2017-03-01 02:39, noreply at z505.com wrote:
> > How come:
> >
> >    class operator Initialize(var aFoo: TFoo);
> >    class operator Finalize(var aFoo: TFoo);
> >
> > in a record are called class operator..
> >
> > why not "record operator"?
>
>
> hahaha... You are asking all the questions I've been meaning to ask too.
> From your question, just goes to show how rubbish Delphi is being
> designed these days. Mixing concepts of class and record
> interchangeably. And now we have "records" with constructors and
> destructors! WTF. EMBT/Delphi are seriously polluting the Object Pascal
> with all this rubbish. Unfortunately FPC feels like they need to follow
> them like lemmings.

Records don't allow destructors, only constructors. Also they allow to more
tightly couple initialization functions for some record with the record
they belong to. Same for operators by the way: without them you couldn't
use a record's operators in generics. Also I personally prefer to have
routines that deal explicitly with a given records type as part of said
record.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170301/e63974fe/attachment.html>


More information about the fpc-pascal mailing list