On Fri, 21 Feb 2014 17:57:57 +0000, Uranuz wrote: > My idea is that pass these options using syntax like this: > > alias Foo!( [ > OptionType.optType1 : 100, OptionType.optType2 : "example", > "someOtherOpt1": "someOtherOptValue", "someOtherOpt2": true > ] ) MyFoo; > > Using [] brackets it's just for example. It could be changed to {} (Like > Object in JavaScript). Of course we can create Pair template: > > template P( alias first, alias second ) > { alias first key; > alias second value; > } > > So we will rewrite previous code like that: > > alias Foo!( > P(OptionType.optType1, 100), P(OptionType.optType2, "example"), > P("someOtherOpt1", "someOtherOptValue"), > P("someOtherOpt2", true) > ) MyFoo; >
You could do something like this: alias Foo!( OptionType.optType1, 100, OptionType.optType2, "example, ...etc... ) MyFoo; To see how to parse this sort of list, take a look at the implementations of std.typecons.Tuple and std.getopt.