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

Michael Van Canneyt michael at freepascal.org
Wed Jul 27 16:03:29 CEST 2016

On Wed, 27 Jul 2016, Jonas Maebe wrote:

> Michael Van Canneyt wrote on Wed, 27 Jul 2016:
>> On Wed, 27 Jul 2016, Maciej Izak wrote:
>>> TNullable<T: record> = proxy record
>>> ...
>>> looks good for me, even better than pure record, the context is more 
>>> clear.
>> Yes. Exactly what Jonas wanted to achieve, I suppose.
> A bitpacked or packed record still behaves like a regular record. If does not 
> behave like a record, it should not be called a record.

Well, it can be a special kind of type helper.

Symply extend the syntax for type helper with a new word.

> Additionally, the @@/@ operator thing is inconsistent with how e.g. 
> ansistrings or dynamic arrays work: @ansistringvar does not get you the 
> address of the first character, but of the variable itself. Similarly, there 
> is no @@ansistringvar to get the address of the ansistring variable itself 
> rather than of the first character, even though the 'value' of an ansistring 
> starts at that first character.
> Procedure variables in Turbo Pascal (and Delphi) are the only type for which 
> this approach was ever was used, and given that they didn't use it anymore 
> later on may indicate that they also thought it was not a very good idea in 
> hindsight. Let alone that we would also start accepting @@@-expressions 
> (https://github.com/maciej-izak/PascalSmartPointers/blob/master/tests/tdefault21.pp 
> ).

Why not introduce an address operator ?

operator @ (T : MyType) : Pointer;


More information about the fpc-devel mailing list