The Tail Operator '#' enables clean typechecked builders with minimal language changes.
bauss
jj_1337 at live.dk
Fri Jan 25 10:31:15 UTC 2019
On Friday, 25 January 2019 at 08:33:51 UTC, Kagamin wrote:
> On Friday, 25 January 2019 at 07:24:10 UTC, FeepingCreature
> wrote:
>> But with the tail operator, this becomes:
>>
>> Foo.build
>> #.a = 3
>> #.b = 4
>> #.c = 5
>> #.value;
>>
>> Which is pure, typechecked, easy to extend and still readable.
>>
>> What do you think?
>
> This is shorter and cleaner:
>
> Foo.build
> .a(3)
> .b(4)
> .c(5)
> .value;
And easy to implement:
https://run.dlang.io/is/0Z0GKb
More information about the Digitalmars-d
mailing list