<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 27, 2018 at 12:30 PM, C Western <span dir="ltr"><<a href="mailto:l@c-m-w.me.uk" target="_blank">l@c-m-w.me.uk</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">The actual code that triggered my interest was:<br></div></div>
<br>
procedure LCLViewExtension.lclSetEnabled<wbr>(AEnabled: Boolean);<br>
var<br>
ns : NSArray;<br>
i : integer;<br>
obj : NSObject;<br>
begin<br>
ns := subviews;<br>
for i := 0 to ns.count - 1 do<br>
begin<br>
obj := NSObject(ns.objectAtIndex( i ));<br>
... process obj ...<br>
end;<br>
end; <br><br>
<br>
Given how common the above bit of code is likely to be, I can't see any way of fixing this without some work in the compiler.</blockquote><div><br></div><div>imho, bad approach to adjust compiler for not safe code. </div><div>However, getting a compiler warning would be nice.</div><div><br></div><div>Some time ago, the compiler has been extended with for-in syntax:</div><div><br></div><div><div>var</div><div> SubView : NSView;</div><div>begin</div><div> for SubView in ns.subviews do<br></div><div> begin</div><div> .. process obj ...</div><div> end</div><div> <br></div></div><div>thanks,</div><div>Dmitry</div></div></div></div>