String Switch Lowering
Seb
seb at wilzba.ch
Sun Jan 28 11:59:19 UTC 2018
On Saturday, 27 January 2018 at 23:12:01 UTC, H. S. Teoh wrote:
> On Sat, Jan 27, 2018 at 09:22:07PM +0000, timotheecour via
> Digitalmars-d wrote: [...]
>> ```
>> 28 dscanner 0x000000010d59f428
>> @safe void
>> ...
>
> I proposed a compile-time introspected getopt() replacement
> before, only to get laughed at by Andrei.
Do you remember his motivation?
FYI: since Nov 2017 Druntime has exactly what you are proposing
https://github.com/dlang/druntime/blob/master/src/core/internal/parseoptions.d
However, it's not really sophisticated as it's intended only to
be used for druntime, but then again, no one is stopping you from
using it:
```
struct Config
{
int a;
string b;
void help() @nogc nothrow {}
}
void main()
{
import core.internal.parseoptions, std.stdio;
string args = "a=42 b=foo";
Config conf;
conf.parseOptions(args);
conf.writeln;
}
```
https://run.dlang.io/is/GVclu2
More information about the Digitalmars-d
mailing list