is there any reason UFCS can't be used with 'new'?
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Sep 28 15:17:00 PDT 2014
On Sunday, 28 September 2014 at 20:50:07 UTC, Jay wrote:
> On Sunday, 28 September 2014 at 20:30:42 UTC, Meta wrote:
>> class Button
>> {
>> typeof(this) text(string t)
>> {
>> return this;
>> }
>>
>> typeof(this) textColour(int c)
>> {
>> return this;
>> }
>> }
>>
>> void main()
>> {
>> auto b = new Button()
>> .text("Hello, world!")
>> .textColour(0xFF000000);
>> }
>
> thanks! where should i put it in this table:
> http://wiki.dlang.org/Operator_precedence ?
I'm not sure. Maybe it's on the same level as the Lambda
Abstraction (14.5), but you'll probably have to do some testing
to figure it out exactly.
More information about the Digitalmars-d-learn
mailing list