monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] "throw usage(); " or "N(); " for argument checking?


From: Thomas Keller
Subject: Re: [Monotone-devel] "throw usage(); " or "N(); " for argument checking?
Date: Sun, 04 Jan 2009 03:27:54 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Timothy Brownawell schrieb:
> Many commands check for eg the right number of arguments like so:
> 
>   if (args.size() != 3)
>     throw usage(execid);
> 
> where others do
> 
>   N(args.size() == 0,
>     F("no arguments needed"));
> 
> 
> This ought to be made consistent, does anyone object to using the
> 'throw usage();' version everywhere?

The only thing which comes into my mind is the automation interface here
- we don't want to provide the full-blown (localized) help output to the
interface here, but rather a hint that the call wasn't syntactically
correct.

This reminds me on something I have on my wishlist - while syntactic
option errors (ie. an option does not exist or is invalid for a given
command) are handled before a command is executed, the argument checking
happens in the command itself. This is usually not a problem, unless we
really want to distinguish between syntax errors and other runtime
errors f.e. in automate...

Thomas.

-- 
GPG-Key 0x160D1092 | address@hidden | http://thomaskeller.biz
Please note that according to the EU law on data retention, information
on every electronic information exchange might be retained for a period
of six months or longer: http://www.vorratsdatenspeicherung.de/?lang=en

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]