http://melpon.org/wandbox/permlink/u8lpOZ9owC7QXfa3
hi, that code is based on ideas and code from this[1] thread.

some examples:

// named and in order
  args!(fun, a=>6, b=>65, s=>"test", f=>1.4);

// named and out of order       
  args!(fun, b=>65, f=>1.4, s=>"test", a=>6);

// unnamed and in order
  args!(fun, 6, 65, "test", 1.4);

// mixed and out of order
  args!(fun, b=>65, 1.4, 6, "test");
        
// with defaults
  args!(fun, 6, 65);
  args!(fun, s=>"some text", 6);
        
// setting member variables
auto foo = new Foo().set!(my => 13, ms => "Foo", mx => 4, mf => 1.6);

// calling static member functions
  args!(Foo.print, s=>foo.ms, f=>foo.mf, y=>foo.my, x=>foo.mx);
        
// calling member functions
  foo.args!(foo.someFun, 4, x=>6, "test", f=>1.99);
  foo.args!("someFun", 4, x=>6, "test", f=>1.99);


i currently don't have much time right now so havent done alot of tests, some issues

properly handling overloads,
calling special methods e.g. constructors, opCall
and probably more

[1] http://forum.dlang.org/thread/awjuoemsnmxbfgzhg...@forum.dlang.org

Reply via email to