[fpc-devel] "Default" discussion for SmartPointers etc

Maciej Izak hnb.code at gmail.com
Wed Jul 27 13:05:38 CEST 2016


2016-07-27 11:24 GMT+02:00 Jonas Maebe <jonas.maebe at elis.ugent.be>:
>
> 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.


I was thinking on additional modifier for that before. We can use something
like this:

=== code begin ===
type
  TNullable<T: record> = record proxy to Instance
  public type
    PT = ^T;
  strict private
    Instance: ^T; // no default word anymore
    function GetValue: T;
=== code end ===


-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160727/ea3b46d8/attachment.html>


More information about the fpc-devel mailing list