<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr">Ryan Joseph <<a href="mailto:ryan@thealchemistguild.com">ryan@thealchemistguild.com</a>> schrieb am Do., 14. Juni 2018, 11:59:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
> On Jun 14, 2018, at 4:44 PM, Ryan Joseph <<a href="mailto:ryan@thealchemistguild.com" target="_blank" rel="noreferrer">ryan@thealchemistguild.com</a>> wrote:<br>
> <br>
> Something I tried was using properties like this but it didn’t work. Is that something properties could do? It feels like they should be able to reach into records fields that since everything is known to the property as time of declaration.<br>
> <br>
> property Position: TVec2D read entity^.position;<br>
<br>
I just did a test and found out property does indeed access record fields (that’s great to know) but when I made it a pointer that’s when it broke. Why not make properties do this?<br>
<br>
type<br>
TEntity = record<br>
position: TVec2;<br>
end;<br>
TEntityPtr = ^TEntity;<br>
<br>
type<br>
TDoor = record<br>
entity: TEntityPtr;<br>
state: boolean;<br>
property position: TVec2 read entity^.position;<br>
end;<br></blockquote></div><div dir="auto"><br></div><div dir="auto">Because one needs to be able to represent the properties in the RTTI. Without pointers all that is needed to access the property from code is an offset. With pointers you'd need to add where dereferences are required especially as the "path" to the final field could be more complex (e.g. Field1^.Field3.Field1.Field5^.FinalField).</div><div dir="auto">For this the solution is a getter function that you can also declare as "inline". </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div>