Set optional function parameter
Simen Kjærås
simen.kjaras at gmail.com
Sat Aug 18 13:51:40 UTC 2018
On Friday, 17 August 2018 at 08:52:53 UTC, Andrey wrote:
> I mean - can I skip some arguments and set only one that I want?
> Hm, Python, it seems to me, support this feature.
There's no such built-in functionality in the language or
standard library, no. As Jonathan pointed out, this has been
implemented as a template multiple times, though. Here's my
version:
https://gist.github.com/Biotronic/fffa7d4c96d760da5129d27ba3307f73
Usage:
named!executeShell("my_command", args.workDir = "my/path")
Missing functionality:
No support for overloads. Sorry.
No handy suggestions for which argument you may have meant when a
typo sneaks in.
--
Simen
More information about the Digitalmars-d-learn
mailing list