std.getopt suggestion
Jonathan M Davis
jmdavisProg at gmx.com
Fri Sep 30 09:01:37 PDT 2011
On Friday, September 30, 2011 13:07:55 Christophe wrote:
> foobar , dans le message (digitalmars.D:145799), a écrit :
> > Does getopt (btw, awful name)
>
> getopt is the name of a Posix function to read option arguments in many
> langages. I don't think it should be changed. People trying to
> accomplish this task will be looking for a function with that name.
The _module_ is named std.getopt. People looking for it are going to find it.
std.getopt.getopt doesn't follow Phobos' naming convention, so that would be a
good reason to change the name to getOpt or getOptions. The fact that Posix
has a function with the same name doesn't necessarily mean all that much,
since Posix uses different naming conventions from Phobos, and our getopt does
not work the same way as Posix' getopt (as I understand it, it's closer to
perl's). Now, there is some argument for leaving it as getopt because of the
fact that several languages use that name, but if we need to change the
defaults for getopt (and it looks like it's probably going to be a good idea
to do so), then we need to change the function's name to avoid silently
breaking code, which makes it so that we need to rename the function anyway.
So, it becomes the perfect opportunity to make the name match Phobos' naming
conventions. If there's no need to try and avoid code breakage by changing the
name, then it's more debatable, but from the looks of it, at minimum, the new
enum value in the pull request, noSpaceOnlyForShortNumericOptions, looks like
it should probably be the default. So, I expect that the defaults will change
slightly.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list