<div dir="auto"><div><div class="gmail_extra"><div class="gmail_quote">Am 09.03.2018 10:14 schrieb "Ryan Joseph" <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br></div></blockquote></div></div></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">
><br>
>> 4) Move() on an object copies memory like a record (as a record does, so this is good). Does that mean they laid out in memory just like records?<br>
><br>
> Yes, although I believe there is a hidden VMT field.<br>
<br>
</div>Not sure how they look in memory but that code works so I guess they’re safe to use as records. I could be wrong though and cause nasty bugs using them as pure data structors (like passing to C functions!)<br>
<br><div class="quoted-text"></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">The VMT field exists if there is at least one virtual method. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br>
><br>
>><br>
>> So why do we have advanced records then if objects do more than records? The overhead of a virtual method table? Records have a better/cleaner syntax for operator overloads than even classes but what else?<br>
><br>
> Simple: Delphi compatibility.<br>
><br>
> You can probably find some of my cries of despair on the mailing lists,<br>
> lamenting the fact that they decided to invent something new when they had<br>
> it all along since many decades :(<br>
<br>
</div>I wonder how much code is shared between objects and records in the compiler. It’s really just a syntax difference if all they really wanted was Delphi compatibility. It’s a real shame to because the time could have been spent making objects more unified with classes.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Objects share roughly as much code with records as classes do as internally classes and objects share most of their code. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>