Passing function parameters by name

bearophile bearophileHUGS at lycos.com
Thu Dec 6 07:26:41 PST 2007


Bill Baxter:
> Also a D implementation probably would lack many of the features of 
> Python's keyword args.  I doubt you would be able to do things like 
> passing an AA as a set of keyword arguments.

I presume a simpler semantics is enough for D; the * and ** semantic of parameter passing in Python 3.0 is probably a bit too much for D.

(And in the future that Python syntax with ** may be implmented too in SkedSkin, that translates a subset of Python to C++. I think the main problem isn't implementing its workings, but managing types: probably those function arguments (those dict values) are all of different type. Python dicts have no problem because it's a dynamically typed language, but D's AA are statically typed. So you may need an AA of Box[string]. Note that IronPython runs on dotnet, that has statically typed AAs, so thy have solved similar problems).

Bye,
bearophile



More information about the Digitalmars-d mailing list