On 8/13/11, bearophile <bearophileh...@lycos.com> wrote: > Andrej Mitrovic: > >> void main(string[] args) >> { >> args.popFront; // get rid of name >> >> foreach (arg; args) >> { >> } >> } > > If I see code like that I probably rewrite it like this: > > void main(in string[] args) { > foreach (arg; args[1..$]) { > } > } >
And what benefit is there to that? I pop the argument and then don't have to worry about it ever again. Whereas you're using [1..$], and later on in your argument parsing code you might introduce a bug like: auto userArgumentCount = args.length; // woops, you'll get 1 extra here due to app name.