On May 1, 2007, at 10:50 AM, Brendan Murphy wrote:

> Thom McGrath wrote:
>> Just curious, why is this considered a warning? Is there some kind of
>> overhead that I missed, or is it just messy code.
>
> Tim Jones wrote:
>> But ... Brendan's check is for ANY block of code.  I very oftne place
>> DIM's inside of If - Then blocks as they are not needed if the If
>> goes one way rather than another.  This is a very valid use and does
>> not incur the issue you mention of DIMing within a loop.
>
> Thom McGrath then wrote:
>> I get the point now. I'm so used to optimizing my loops that I didn't
>> consider somebody would actually put a dim inside a for-next loop.
>>
>> So really, this should be checking for dims inside loops, rather than
>> every block.
>
> This whole discussion misses the point. Maintenance of the code
> "trumps" all the merits of putting DIM statements in any
> other place but the top of the method since putting DIM statements
> within the code are negligible at best. If you scatter your DIM
> statements within your code you make your code harder to read.
> Which is more important, your time as a developer or some
> negligible benefit? If your time is only worth $1 an hour, then
> have at it an write unmaintainable code, but the professional
> developers typically earns $50 or more an hour and making your
> code harder to read is rather short sighted.


I disagree.  I use block-scoped dim statements all the time.  In  
addition to the points raised by Glenn and Joe, I'll add a third --  
block scoping is a form of information hiding that imposes a useful  
discipline on design.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to