<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 20/02/2019 14:36, Paul van Helden
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPjGFZcBpA2mUeRB8gATwjC4nhg_PWBH8cyB6aqWSfEEQBn8rQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote"><br>
<div>So the argument against is: (1) split your long
functions, because you should; and (2) Wirth didn't do it,
so good it is not.</div>
<div><br>
</div>
<div>Long functions *might* be an indication of bad design,
but you know, sometimes I have a long function that
doesn't make sense to split.</div>
<div><br>
</div>
<div>Here is a good article about inline vars: <a
href="http://blog.marcocantu.com/blog/2018-october-inline-variables-delphi.html"
moz-do-not-send="true">http://blog.marcocantu.com/blog/2018-october-inline-variables-delphi.html</a></div>
<div><br>
</div>
<div>What's not to like about for var I:=0 to Count-1 do.. ?</div>
<div><br>
</div>
<div>Or var
MyDict:=TDictionary<Integer,String>.Create;</div>
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
1) "for" (and other) loops with a long body also exist. <br>
So the problem is still there, if I encounter "i" in the middle of a
1000 line for-loop, I still do not see its declaration. So far, no
loss, but no gain either.<br>
<br>
2) Nested loops exist. If in the middle of such a 1000 line
for-loop, I want to declare another loop, then I need to find a free
identifier for that variable.<br>
Today, I can do that by looking at the declaration on top of the
procedure (and afaik depending on context, the class fields).<br>
With inline declaration, I have to find each of the 10 surrounding
for-loops, scattered over a 1000 lines (And that is ignoring any
variables declared inline, but not as part of a for-loop). I would
say that is definitely worse.<br>
But just my 2 cents.<br>
<br>
Now do not tell me that those loops should be refactored, because
they are based on your statement that this is not always sensible.<br>
<br>
3) As for duck typing:<br>
for var i:= Func1 to Func2 do;<br>
<br>
What if that is "QWord to int64(or at some future points changes to
that)?<br>
What will "i" then be? And why?<br>
Or should that be a compile error? (Probably the best)<br>
</body>
</html>