Assign Range: layout = X, AlignRight;

Виталий Фадеев vital.fadeev at gmail.com
Tue May 26 13:52:14 UTC 2020


On Tuesday, 26 May 2020 at 13:36:34 UTC, Виталий Фадеев wrote:
> I want this:
>
>     layout = X, AlignRight;
>
>
>
> Use case:
> class Widget
> {
>     struct Layout
>     {
>         ILayout[] _layouts;
>
>         void opAssign( args... )
>         {
>             foreach( a; args )
>             {
>                 _layouts ~= a;
>             }
>         }
>
>
>         alias _layouts this;
>     }
> }
>
>
> in front-end code:
>
>     with( new Widget() )
>     {
>         layout = X, AlignRight;
>     }
>
>
> I think the solution:
>    void opAssign( args... ) { ... }
>
>
>
> I want this feature in D!

Main goal is: Readable, clean, beauty code.



More information about the Digitalmars-d-learn mailing list