Re: problems with the scoping in eu4

new topic     » goto parent     » topic index » view thread      » older message » newer message
bill said...

About delarations in loops I am clearly of the opinion it is a mis-feature. Perhaps I am in a minority of one thinking this. Also I think while with entry is a mis-feature again it is my opinion.

If I use Euphoria I will not use these features.

Quite a few other languages must be in err as well, C/C++, Java, D for a few. Not that we are trying to copy those, but when you declare a variable inside of a loop, it just makes sense that the declaration occur each iteration of the loop.

For example:

integer cnt = 1 
for i = 1 to 10 do 
    cnt += 1 
    ? cnt 
end for 

You would expect that cnt += 1 would execute 10 times, no? Not 1 time, 5 or 8 times, correct? Why, then, would:

for i = 1 to 10 do 
    integer ten_i = i * 10 
    ? ten_i 
end for 

be any different? Each iteration, just as cnt += 1 is executed, integer ten_i = i * 10 is executed. To do anything different would be very confusing, bug producing, extremely complicated to explain and use, IMHO. For example, I don't even know what the above program should do if it didn't initialize ten_i each iteration as the code says.

Now, the with entry, I feel it's a great option. About jumping around, a loop is nothing but a conditional goto, the with entry is also nothing but a goto. Both make sense to me and both make my existing programs simpler. The less code I write as a developer means the more productive I will be (within reason of course). Thus, nice shortcuts like this make me as a developer more productive thus as an employee more profitable. In todays programming market, I enjoy being more profitable to my clients. Yes, something as simple as with entry makes a difference in clarity or code and profitability.

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu