Postfix type notation - readability and parsing?

Basile B. b2.temp at gmx.com
Thu Mar 7 08:32:26 UTC 2019


On Wednesday, 6 March 2019 at 18:06:34 UTC, Basile B. wrote:
> On Tuesday, 5 March 2019 at 22:29:33 UTC, aliak wrote:
>   Now to come back to the problem you concretely encounter, I 
> know what your are trying to do and you can do it otherwise: 
> use an UDA. Instead of
>
>     static immutable Option!(ushort, "p|port", "Sets the port 
> used for serving.", "PORT", 8888) port;
>
>
> try to do
>
>     @Option!("p|port", "Sets the port used for serving.", 
> "PORT", 8888)
>     static immutable ushort port;
>
> you see ?

Well since it's an uda you change the thing to a non template 
struct:

   @Option("p|port", "Sets the port used for serving.", "PORT", 
8888)
   static immutable ushort port;

By the way i proposed this because I did something like that 
which worked quite correctly although no finished: 
https://github.com/Basile-z/iz/blob/d9e36efced7069600b2d04b5a30fe905d6125347/import/iz/options.d#L602




More information about the Digitalmars-d mailing list