Why: error("multiple ! arguments are not allowed");

Stanislav Blinov via Digitalmars-d digitalmars-d at puremagic.com
Sun May 21 07:11:00 PDT 2017


On Sunday, 21 May 2017 at 13:42:50 UTC, Vladimir Panteleev wrote:
> On Sunday, 21 May 2017 at 13:08:18 UTC, Adam D. Ruppe wrote:
>> foo!(x)!y
>
> I think it's the same as foo!x!y. As for the reason - I think 
> because the order is possibly ambiguous or something? You could 
> interpret it as either (foo!x)!y or foo!(x!y).

I did encounter that a few times too, and my humble opinion is 
that there should not be any ambiguity, it should just be 
left-to-right, i.e.:

foo!x!y is the same as (foo!x)!y, and

foo!x!y!z!w would be (((foo!x)!y)!z)!w

This is no different from

foo!x.bar, which is (foo!x).bar and not foo!(x.bar)

Allowing this will only help reduce boilerplate. If we do need 
different order, we could always explicitly instantiate 
beforehand.


More information about the Digitalmars-d mailing list