[Pdx-pm] Getopt::Modern usage model

Austin Schutz tex at off.org
Fri Jun 10 01:14:32 PDT 2005


On Fri, Jun 10, 2005 at 12:39:05AM -0700, Eric Wilhelm wrote:
> # The following was supposedly scribed by
> # Austin Schutz
> # on Thursday 09 June 2005 09:49 pm:
> 
> >Come to think of it, I don't see why you need to monkey with it
> >at all. If the author wants to interpolate ~ all they have to do is
> >s/^~/$ENV{HOME}/. Document it as a gotcha for the author to be aware
> > of. 
> 
> But it's really a gotcha for the user, which is just one more thing for 
> the author to have to document.

	I'm making the assumption that the author will have a good idea
of what will be intuitive for the users and code accordingly.

> 
> > Also by doing that you can pass off responsibility for cases 
> > where the user didn't want shell interpolation, --foo='~' or similar.
> > Otherwise there's no way of knowing. Actually, that makes it a good
> > excuse for calling this "the right thing to do", which I would
> > propose that it is.
> 
> It's actually starting to sound like this is a good reason to call the 
> --whole=thing off.  If the user doesn't want shell expansion, they 
> can act accordingly.
> 

	..on the other hand, there's nothing forcing anyone to use the
--foo=bar syntax in the first place. You could always make it an option
the author could enable. If the author has something generally benign in mind,
it could be very useful, imo.

> Also, I was thinking that the issue actually involved all sorts of shell 
> expansion, but it looks like it only really involves the ~.
> 

	Yeah, I suspect that's correct.

> However, it still introduces a few inconsistencies.
> 
>   --this=a{d,c,b}e   ne   --this a{d,c,b}e

	I'm already confused by this. I would also be wary of using {}s
at all w/out quoting, you never know what a given shell might do with them.

> 
> > Otherwise there's no way of knowing.
> 
> I think the best way of knowing is to not go there.  --this '~' allows 
> the user to be very clear about what they mean and I don't see why any 
> program or module should second-guess that.  If --this=~ is supposed to 
> be treated in a special way (which is actually a work-around to the way 
> the shell treats words), then I don't think it's going to be worth the 
> extra code.
> 
> If I don't try to make everyone happy, the module is unused.  If I do 
> it's useless right?
> 

	Well, I think there's a sort of third option - give everyone the
option to be happy, but set defaults that make you happy. :-)
	I can think of several instances where an author didn't think a
particular feature was very interesting that I found invaluable.

	That said, it is _your_ module. If you don't feel comfortable
doing a particular thing, don't be bullied into it. At least not without
a good deal of consideration. In the end you will be the one maintaining
the cruft.

	Austin


More information about the Pdx-pm-list mailing list