const main args?
Jonathan M Davis
jmdavisProg at gmx.com
Fri Aug 12 15:58:20 PDT 2011
On Friday, August 12, 2011 15:51 Andrej Mitrovic wrote:
> That's pretty stupid, of course you want to modify the arguments.
>
> Classic example:
>
> void main(string[] args)
> {
> args.popFront; // get rid of name
>
> foreach (arg; args)
> {
> }
> }
getopt alters the arguments too. I'm not sure that it should be disallowed to
use
void main(in string[] args)
but I'd argue that doing that is generally incredibly counter-productive. Of
course, I'm against the use of in with arrays in general. const(T)[] maybe,
but as soon as you use in, you can't use any range functions. A totally const
or immutable array is generally useless IMHO.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list