<br><br><div class="gmail_quote">On Wed, Aug 3, 2011 at 7:15 PM, Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><br></div>
Like I said, there is a 'risk' when using with, I know this. But I think it is very small indeed.<br>
(in fact, last week I had such an error after refactoring code, but it was the first time in maybe 10 years)<br>
<br>
I just don't think that the solutions presented will make it any better.<br>
Say you introduce a switch that forces you to use 'With'.<br>
Then what ?<br>
<br>
You'll have to check all 'with' statements because suddenly they no longer compile.<br>
I doubt this will make you find the bug. In the worst case, you'll end up prefixing the wrong properties with 'self'.<div><div></div><div class="h5"><br>
<br></div></div></blockquote></div><br><br>Let's forget about the suggestion with mandatory self, it wasn't a good for plenty of reasons :). I'd left with the one that shows error when 'with' brings unambiguousness. I think there's no big problem with unique names like myspecialproperty or something like this, but there are also: <br>
<br>count, length, items, width, height <br><br>used many times in lcl and elsewhere (btw, it's interesting to know the name of yours in your example). Introducing the switch and enabling it now and forever will be like an investment to the future, you won't notice the difference right now, but it will make you safer later if some of the object used in 'with' statement introduce a property with one of those frequently used names and this could instantly change the context of some lines. <br>
<br>Anyway, it's not a big deal to encourage the developers who has many more important things to do, maybe a reason to look into the internals of freepascal myself and find out more :)<br><br>Max<br><br>