Another syntax improvement idea

ryuukk_ ryuukk.dev at gmail.com
Sat Nov 26 18:07:40 UTC 2022


Oops, actually the provided example works (when you fix the extra 
's' for 2. my bad!)

However, my code that lead me to write this post doesn't:

```D
extern(C) void main(int argc, char**argv)
{
     parse(argc, argv, [

         // works
         // Option( "-n", (value) { }),

         // doesn't work
         {
             key: "-n",
             cb: (v) {}
         }
     ]);
}
struct Option
{
     alias cb_t = void function(const(char)[]);
     const(char)[] key;
     cb_t cb;
}

void parse(int argc, char**argv, scope const Option[] options)
{

}
```


This one doesn't..


More information about the Digitalmars-d mailing list