[fpc-devel] "Default" discussion for SmartPointers etc
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Jul 27 11:24:59 CEST 2016
Maciej Izak wrote on Wed, 27 Jul 2016:
> @@ operator is very simple way to determine where you point. In any other
> case we have casting hell. See below (and more below). @@ exist rather as
> fulfillment to pa := @a; form tdefault7.pp (anyway is necessary for untyped
> pointers). You might not like @@ operator but @@ is part of long tradition.
> In practice works like a charm and is very clear.
Getting rid of the @@-operator is also part of a long tradition in
FPC. In fact, it was one of the first differences between FPC and
Turbo Pascal modes, and it is the reason why we use a different
procvar syntax (because we considered it very unclear). There is no
@@-operator in FPC/ObjFPC modes at this time.
On a more general note, I think the fact that @recordvar no longer is
a pointer to the record is wrong. You need a different keyword instead
of "record" in that case (or possibly a modifier for the "record"
keyword, like with "class abstract" -- but this is not a record at any
more than an shortstring is a record, so I don't think that's a good
idea either).
Completely changing how certain aspects of a record are treated by the
compiler only based on the fact that somewhere there is a "default"
modifier for one field is not good. You should definitely not have to
go through an entire declaration of a record to be able to know how it
will behave.
Jonas
More information about the fpc-devel
mailing list