foreach

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 12 17:36:54 PDT 2014


On 6/12/14, 5:06 PM, Steven Schveighoffer wrote:
> On Thu, 12 Jun 2014 15:26:31 -0400, Nick Sabalausky
> <SeeWebsiteToContactMe at semitwist.com> wrote:
>
>> On 6/12/2014 3:10 PM, Steven Schveighoffer wrote:
>>>
>>> Sorry, saving 1-2 characters typing is really minor. This does not, in
>>> my opinion of course, have any significant improvement on usability for
>>> D. It simply does not carry it's own weight, and the potential to create
>>> bugs in the foreach handling would be not worth the risk.
>>>
>>
>> While I agree on its triviality, I really doubt there's much "weight"
>> to speak of either. Hara probably could've already implemented and
>> tested this in the same amount of time any *one* of us have already
>> spent bikeshedding it.
>>
>
> I don't think it's as trivial as you imply. You have to use a symbol
> that's valid, but isn't used in the subsequent loop to avoid collisions.
>
> -Steve

You normally do that by using names that the grammar doesn't allow as 
valid identifiers. Then you have a counter and prepend that. This way 
you never have name collisions.


More information about the Digitalmars-d mailing list