<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-03-07 17:12 GMT+01:00 Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""></span>Might be, but even then you can commit that separately.<span class="">
<p></p></span><p></p></blockquote><div>Might be ;)<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p>Jonas meant that you didn't use "aFoo" inside the body of the Initialize/Finalize operators. Is that a copy and paste oversight or does that really work? In the latter case: that definitely shouldn't be the case then.</p></blockquote><div>Oh my... Sorry! This is definitely copy and paste oversight :\ Correct example code:<br><br><div>===== example begin =====</div><div>{$MODE DELPHI}</div><div>uses SysUtils;</div><div><br></div><div>type</div><div> TFoo = record</div><div> private</div><div> class operator Initialize(var aFoo: TFoo);</div><div> class operator Finalize(var aFoo: TFoo);</div><div> public</div><div> F: Integer;</div><div> S: string;</div><div> P: Pointer;</div><div> C: TObject</div><div> end;</div><div><br></div><div>class operator TFoo.Initialize(var aFoo: TFoo);</div><div>begin</div><div> aFoo.F := 10;</div><div> aFoo.S := 'FPC rulezzz';</div><div> aFoo.P := nil;</div><div> aFoo.C := nil;</div><div>end;</div><div><br></div><div>class operator TFoo.Finalize(var aFoo: TFoo);</div><div>begin</div><div> if aFoo.S = 'Delphi rulezzz' then</div><div> raise Exception.Create('Trololo');</div><div> FreeMem(aFoo.P);</div><div> aFoo.C.Free;</div><div>end;</div><div><br></div><div>procedure Foo;</div><div>var</div><div> f: TFoo;</div><div>begin</div><div> WriteLn(f.F); // output: 10</div><div> WriteLn(f.S); // output: FPC rulezzz</div><div> WriteLn(f.P = nil); // output: true</div><div> WriteLn(f.C = nil); // output: true</div><div>end;</div><div><br></div><div>begin</div><div> Foo;</div><div>end.</div><div>===== example end=====</div> </div></div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>