[Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!

Sven Barth pascaldragon at googlemail.com
Tue Oct 24 21:37:53 CEST 2017


On 24.10.2017 19:00, Giuliano Colla via Lazarus wrote:
> Il 24/10/2017 17:04, Sven Barth via Lazarus ha scritto:
>>
>>         @NextProc := Coda.Remove;
>>         Sending := True;
>>         NextProc;
>>
>>     with NextProc defined as a procedure of object does compile but
>>     it's wrong.
>>
>>
>> Why are you using an @ when you assign the NextProc variable? O.o
>>
> Because it's required by Delphi syntax. An unqualified procedural type
> means a call to the procedure.
> 
> Without the @ it would rise an "invalid left hand assignment" error.

You're completely defeating the type system here and at least in Delphi
XE the value of Self is Nil if I do it like you did above. If it indeed
worked in older versions then it probably worked completely by accident.

Regards,
Sven


More information about the Lazarus mailing list