Postfix type notation - readability and parsing?

Kagamin spam at here.lot
Thu Mar 7 08:21:16 UTC 2019


On Tuesday, 5 March 2019 at 22:29:33 UTC, aliak wrote:
> This is the most "readable" formatting I could think of for 
> long declarations with current syntax.
>
> static immutable Option!(ushort, "p|port", "Sets the port used 
> for serving.", "PORT", 8888)
>         port;
> static immutable Option!(int, "db-port", "Sets the port to use 
> for connecting to the db", "DB_PORT", 5432)
>         dbPort;
> static immutable Option!(string, "db-host", "Sets the port to 
> use for connecting to the db", "DB_HOST", "127.0.0.1")
>         dbHost;
>
> The template declaration is quite long so:

This works:

struct Option(T...)
{
     string a;
}

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


More information about the Digitalmars-d mailing list