Re: problems with the scoping in eu4
- Posted by mattlewis (admin) Jan 09, 2011
- 1637 views
petelomax said...
jimcbrown said...
jeremy said...
with entry ... no duplication
... but at least there's no need to duplicate code for this case.
You are both inventing this. It is always perfectly ok to replace
while <condition> with entry do <block a> entry <block b> end while
with the much clearer
while true do <block b> if not <condition> then exit end if <block a> end while
You can like "with entry" and I can dislike it, but please stop saying it removes code duplication or makes things easier to read when it achieves neither.
It's a fair point, that absolute claims regarding style preferences are going to wrong. While the code is no less correct using an if-then-exit pattern, personally, I find it more difficult to read, and so I'd say it's neither always perfectly ok, nor much clearer. I'd usually rather duplicate some code to initialize the condition.
So, yes, I guess we'll agree to disagree.
Matt