[Mono-dev] Mono.GetOptions Option Bundles

Almann T. Goo almann.goo at gmail.com
Fri May 5 14:18:31 EDT 2006


>
> This affects the VerboseParsingOfOptions and DebuggingOfOptions members in
> particular since these are non-virtual properties and you will always have
> these options regardless of what you may desire.


Incidentally, I think the issue would be resolved more or less if the
properties in question were declared as virtual.  At least then you could
"KillOption" them.

This is what I was thinking when I was talking about using an interface:

using Mono.GetOptions;

// option bundle with only one option
public class MyOptionBundle : IOptionBundle {

    private Options std;

    public MyOptionBundle( Options standard ) {
        std = standard;
    }

    [Option("Shows this help", 'h', "help")]
    public WhatToDoNext DoHelp() {
        return std.DoHelp();
    }

}

internal class Driver {
    public static void Main( String args[] ) {
        Options standard = new Options();
        // change to our custom one -- defaults to itself
        standard.Bundle = new MyOptionBundle();

        // parse!
        standard.ProcessArgs( args );

        // ...
    }
}

IOptionBundle would be an interface that Options would implement.  Then
OptionList could use this theoretical Bundle property to get the object to
iterate over as the options bundle.  By default this property could be
assigned to the Options instance enclosing it (for the functionality that is
present today).

Just some food for thought.

Best Regards,
Almann

--
Almann T. Goo
almann.goo at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060505/f1fa7109/attachment.html 


More information about the Mono-devel-list mailing list