Will D ever get optional named parameters?
"岩倉 澪" via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 20 09:22:16 PDT 2014
Slightly off-topic, but I'm learning the constructed (human)
language lojban, and the FA and zo'e constructs remind me of
named parameters and _.
In lojban there are constructs called selbri that are kind of
like a programming languages functions: vecnu = x1 sells x2 to x3
for price x4
x1, x2, x3, x4 representing positional parameters
If you don't want to specify one you pass zo'e which is like the
word "something."
If you leave off some sumti (args), it is equivilant to passing
zo'e. Five selbri parameters have names, fa, fe, fi, fo, fu. So
you can pass them in any order if you put those tags in front.
More on-topic: I don't really think named parameters are a
worthwhile feature, but I really hope D gets __. That seems like
it wouldn't have any major conflicts with implementing, and would
give functions a bit of a boost in terms of expressiveness.
More information about the Digitalmars-d
mailing list