[fpc-devel] Defer keyword

Kostas Michalopoulos badsectoracula at gmail.com
Tue May 11 04:21:41 CEST 2021


On 5/11/2021 4:09 AM, Ryan Joseph via fpc-devel wrote:
> 
> 
>> On May 10, 2021, at 5:59 PM, Kostas Michalopoulos via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
>>
>> You do not need any special language feature for that, you can simply do something like
>>
>>     ReleaseLater(TObject.Create)
> 
> yes but we can't get back the reference. It's a small thing but making this possible as return type means we can chain the calls together and make it a one line statement. It's just a nice thing from Objective-C which we use heavily to manage memory and it works very well.

How about function ReleaseLater(Obj: TObject): TObject that simply 
returns Obj? (though TBH i can't say i am a fan of these chains from a 
readability perspective).

Kostas


More information about the fpc-devel mailing list