Loop iterator - example.txt

Derek Parnell derek at psych.ward
Sun Apr 30 15:44:53 PDT 2006


On Mon, 01 May 2006 05:28:17 +1000, <kellywilson at nowhere.com> wrote:


> However, since we can just write the code with a
> different construct and/or 'goto's, then should we use extra keywords  
> and make
> the language even bigger?

If one takes this argument, we should remove constructs such as 'for',  
'foreach', 'switch', 'while' etc...

> Maybe you are suggesting that it would be easier to
> just let the compiler add in the correct jumps instead of making the  
> user add in
> explicit 'goto's and possibly use a different construct?

Yes. Source code is supposed to be primarily designed for humans to read  
and thus we need to help humans understand the intent of the code and  
leave the compiler to correctly translate it for the machines.

>
> I think the new keyword (or words if we include 'restart' as well) may  
> lead to
> some nasty little logic bugs for new users, if they aren't careful,  
> though. I
> know that can be said about many 'new' keywords/features for newer  
> languages,
> but still, in this case it may be troublesome for those moving from  
> C/C++.
> Maybe? Thoughts?

So what! Let them learn D instead.

> P.S. Your example does rather pointedly show that this can all be solved  
> easily
> with some 'goto's as Walter showed/suggested earlier ;) One argument for  
> goto's
> follows:  http://www.ppig.org/papers/12th-marshall.pdf
> or here:  http://www.stevemcconnell.com/ccgoto.htm

My take on goto is that its usage is justified when there is no other way  
to add performace to a demonstably performance critical section of code.  
In other words, the 'cost' of using goto must be offset by some other gain.

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list