The Tail Operator '#' enables clean typechecked builders with minimal language changes.

FeepingCreature feepingcreature at gmail.com
Fri Jan 25 12:10:20 UTC 2019


On Friday, 25 January 2019 at 10:31:15 UTC, bauss wrote:
>> This is shorter and cleaner:
>>
>>     Foo.build
>>       .a(3)
>>       .b(4)
>>       .c(5)
>>       .value;
>
> And easy to implement:
>
> https://run.dlang.io/is/0Z0GKb

Yeah but it doesn't look like assignment. And it's only as 
readable because the examples are oversimplified.

     Foo.build
       .property(source.property.call(bla, bla, 
bla).map!"a.BlaAttribute"))

And it becomes much harder to understand the builder principle as 
compared to

     Foo.build
       #.property = source.property.call(bla, bla, 
bla).map!"a.BlaAttribute"

We have operators for a reason.



More information about the Digitalmars-d mailing list