<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-09-16 12:36 GMT+02:00 Frederic Da Vitoria <span dir="ltr"><<a href="mailto:davitofrg@gmail.com" target="_blank">davitofrg@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><div class="gmail_quote">2014-09-16 12:26 GMT+02:00 Philippe <span dir="ltr"><<a href="mailto:philippe@quarta.com.br" target="_blank">philippe@quarta.com.br</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><u></u>
<div>
<p>Em 16.09.2014 05:44, Frederic Da Vitoria escreveu:<br></p>
<blockquote type="cite" style="padding-left:5px;border-left-color:rgb(16,16,255);border-left-width:2px;border-left-style:solid;margin-left:5px;width:100%"><div><div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">2014-09-14 16:23 GMT+02:00 Mark Morgan Lloyd <span><<a href="mailto:markMLl.fpc-pascal@telemetry.co.uk" target="_blank">markMLl.fpc-pascal@telemetry.co.uk</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I'd be far happier if there were provision for declaring a temporary "shortcut" symbol:<br><br> with shortcut: TSomething= TreeRoot.SubDirs[Low(TreeRoot.<span style="text-decoration:underline"></span>SubDirs)]^ do<br>    begin<br>    shortcut.DirLogged             := true;<br>    shortcut.DirHatFocus           := false;<br>    shortcut.SubDirsExpanded       := true;<span><br></span></blockquote>
</div>
<br>Yes, something close to alias in SQL, instead of plain elision which "with" currently performs. This would allow for a clearer writing without the pitfalls of the Pascal "with".<br clear="all">
<div> </div></div></div></div></div></blockquote><p>could the compiler avoid "with" pitfalls?</p><p>now the compiler attach a property to the closest "with" where it finds it.</p><p>the compiler could check if the property appears in another "with" of the "with" stack and produce a message (hint, warning or error, which may be configurated).</p><p>is not it a way to make the "with" safe?</p></div></blockquote></div><br></span>I don't think it would make it safe, only slightly safer. Imagine: you are using 2 nested "with" which have a field with the same name. The compiler would tell you so. You'd check and decide that it's OK because you really intended to mean the internal "with". Then, later, you remove or rename the field which is used in the internal "with". The compiler won't send you any warning since you will have removed a danger. But the meaning of your code will have changed and will now be wrong. Will you remember that there was a warning before and will you realize that the fact this warning disappeared means trouble?</div></div>
</blockquote></div><br>Your suggestion would be safe if the option was configured to "error". Then, in such a situation, the developer would have to fully qualify each ambiguous field which should remove any chance of error.<br clear="all"><div><br></div>-- <br>Frederic Da Vitoria<br>(davitof)<br><br>Membre de l'April - « promouvoir et défendre le logiciel libre » - <a href="http://www.april.org" target="_blank">http://www.april.org</a><br>
</div></div>