Associative parameters
BCS
ao at pathlink.com
Tue Jul 10 14:11:18 PDT 2007
Reply to Pragma,
> FWIW, ColdFusion script also offers named arguments, but it takes the
> all-or-nothing approach; if you name one arg, you must name all that
> you pass. IMO, the python strategy (positional followed by named
> arguments) is much more intuitive.
>
if we get named parameters, then we should also be able to get a tuple of
parameter names.
maybe something like this:
is(typeof(fn) args = function);
is(fn argNames = names);
args val;
foreach(name; argNames) val[name] = typeof(val[name]).init;
this would make my argument biding template(*) more robust.
static int fnc(int that, char has, bool lots, int[] of, float args)
// bind some args
alias Args! (0,2,4).Become!(1,true,1e7).For!(fnc).Gives fn2;
vs.
alias Args! (that,lots,args).Become!(1,true,1e7).For!(fnc).Gives fn2;
* http://www.dsource.org/projects/scrapple/browser/trunk/arg_bind/bind.d
More information about the Digitalmars-d
mailing list