From: Walter Bright Date: Fri, 07 Sep 2007 23:16:28 GMT Subject: Re: [RFC] Convert builin-mailinfo.c to use The Better String Library. Message-ID: In-Reply-To: <851wda2pbo.fsf@lola.goethe.zz> David Kastrup wrote: > The problem is a toy problem: in real applications, Necessarily, to make an example suitable for a n.g. post, I ruthlessly cut down the size of it. This can have the inadvertent effect of making it appear trivial. > you'll need to > access several data structures using the same index, and you'll need > to be able to assign index values to temporary variables and so on. The index is available: foreach (index, value; array) { writefln("array[%s] = %s", index, value); } and it isn't necessary to worry about what the correct type for index is, as it is inferred. > So being able to hide the type of an index in one very specific > application (looping through a single array completely) foreach'ing over a subset (i.e. slice) of an array: foreach (value; array[5 .. $]) ... loop from 5 to the end ... > at one place is not going to buy you much. Experience with foreach in real code shows that the for loop is what becomes a rarity. Simple as it is, foreach is one of the best liked improvements D has. And I speak as one who has written so many for loops that spewing out: for (int i = 0; i < 10; i++) is a 'finger' macro for me, i.e. my fingers blit it out without even thinking about it. > Anyway, D is pretty much irrelevant as a perspective for git, so you > should take it to a language advocacy group. I wished to answer your specific comments in this post.