On Sat, Jan 27, 2018 at 09:22:07PM +0000, timotheecour via Digitalmars-d wrote: [...] > ``` > 28 dscanner 0x000000010d59f428 @safe void > std.getopt.getoptImpl!(std.getopt.config, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], immutable(char)[]*, > immutable(char)[], immutable(char)[]*, immutable(char)[], bool*, > immutable(char)[], immutable(char)[][]*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*).getoptImpl(ref immutable(char)[][], ref std.getopt.configuration, ref > std.getopt.GetoptResult, ref std.getopt.GetOptException, > void[][immutable(char)[]], void[][immutable(char)[]], std.getopt.config, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*, immutable(char)[], > bool*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], immutable(char)[]*, immutable(char)[], > immutable(char)[]*, immutable(char)[], bool*, immutable(char)[], > immutable(char)[][]*, immutable(char)[], bool*, immutable(char)[], bool*, > immutable(char)[], bool*, immutable(char)[], bool*) + 460 > ``` > > https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/ doesn't > seem to help in cases like that
This has nothing to do with name mangling. The mangling itself may be relatively small (and probably is, judging from the amount of repetition in the signature above), but what you're looking at is the *demangled* identifier. That's going to be big no matter what, unless we fundamentally change the way getopt() is implemented. I proposed a compile-time introspected getopt() replacement before, only to get laughed at by Andrei. So I guess that means, don't expect to see that in Phobos anytime soon. But I might post the code on github sometime for those who would benefit from it. Basically, instead of taking a ridiculously long argument list, you create a struct whose members (together with some UDAs) define what the options are, any associated help text, etc., and just call it with the struct type as argument. It does its thing, and returns the struct populated with the values retrieved from the command-line. There are a few more features, but that's the gist of it. T -- There is no gravity. The earth sucks.
