<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-04-13 5:02 GMT+02:00 Ryan Joseph <span dir="ltr"><<a href="mailto:ryan@thealchemistguild.com" target="_blank">ryan@thealchemistguild.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">Why can’t we just do something simple like this? A simple meta programming hack to dump the “default” section at the start of the scope the variable is declared in so we don’t have to do this ourselves every time. It probably breaks down for init’ing records but for compiler types it seems pretty simple.<br></blockquote><div><br></div><div>No need for something like new default section. You can just use :</div><div><br></div><div>===code begin===</div><div>{$MACRO ON}</div><div>{$DEFINE TMyRecord_Default := (i: 1; s: 'foo')}</div><div><br></div><div>type</div><div> TMyRecord = record</div><div> i: integer;</div><div> s: string;</div><div> end;</div><div><br></div><div>var</div><div> myRec: TMyRecord = TMyRecord_Default;</div><div>===code end===</div><div><br></div><div>you can also try new management operator "Initialize": </div></div><div><br></div><div><a href="http://wiki.freepascal.org/management_operators">http://wiki.freepascal.org/management_operators</a><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>