[Mono-dev] Program Option Parsing Library

Jay Logue jay-MonoDev at toaster.com
Sun Jan 13 15:00:37 EST 2008

Looking good!
> One final note: due to the above Action change, I'm using Action`2,
> which is specific to .NET 3.5.  Localization is via Func`3, which is
> specific to .NET 3.5.
I guess I don't really understand why its important to use Action and 
Func here, verses custom types (e.g. void OptionAction<T>(T v, 
OptionContext c) ).  In the vast majority of cases the delegate values 
will be initialized from direct method references, anon. delegates or 
lambda expressions, which means that the user wont really care what the 
delegate type is.  And if the code used its own types you wouldn't need 
the conditional compilation.

On a related note, could the translation delegate be simplified to 
Converter<string, string> and just used to translate the format string?  
Its not clear to me that having access to the format arguments is all 
that useful in this context.  Most other cases of localization I've seen 
only translate the format string.
> If LINQ is defined you also get a (for fun) Options.Parse()
> implementation that uses LINQ syntax.  It's 11 lines shorter, and has so
> many nested ternary operators I'm not sure it's more readable.  But it's
> fun. :-)
Well, I'm always a little leery of things that are fun for the writer 
but not for the reader.  Still, its important to have a little fun once 
in awhile. :-)

Again, great work, and thanks for doing this.

-- Jay

More information about the Mono-devel-list mailing list