On Thursday, 12 June 2014 at 15:56:17 UTC, simendsjo wrote:
On 06/12/2014 05:46 PM, monarch_dodra wrote:
On Thursday, 12 June 2014 at 15:09:51 UTC, simendsjo wrote:
_ is an often used identifier for "i don't care" in many
languages. The
following works:
foreach(_; 0..n)
One issue is that "_" is still an actual identifier, with
normal name
collision rules. So that works only once. When you nest your
loops,
you'll end up having conflicts, and name your "i don't care
variable"
things such as "_", "__", "___", "_1", "_2" etc...
It actually happens quite often I find.
Yeah, not good. Does any sane person use _ as a variable
identifier and
then reference it? A breaking change would be a special rule so
_ can
never be used and is allowed to shadow. Of course - this could
break
existing code, so it will never happen :)
An identifier could be chosen that started with two underscores.
Those are already reserved.