[DIP] In-place struct initialization
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jul 30 21:55:31 PDT 2016
On Saturday, 30 July 2016 at 21:42:42 UTC, cym13 wrote:
> The most interesting is to use structs to mimic keyword
> arguments for
> functions. By encapsulating possible arguments in a struct it
> is possible to
> use in-place initialization to provide a clean interface very
> similar to
> keyword arguments such as seen in python or ruby.
>
That doesn't help. In fact, it makes things worse as now
constructor calls and function call do not have the same syntax.
You've just created an holly mess in the parser.
If something we should strive to get constructor call more like
regular function call rather than less (for instance by behaving
the same way when it comes to IFTI).
It is also unclear how overload resolution is supposed to work.
If I may suggest one thing it is to not start with the intended
result for the DIP, but start from the intended change int he
language, then, and only then, examine what comes out of it.
More information about the Digitalmars-d
mailing list