digitalmars.D - Why: error("multiple ! arguments are not allowed");
- Adam D. Ruppe (7/7) May 21 2017 Why is that prohibited? I just wrote
- Adam D. Ruppe (7/8) May 21 2017 Well, not exactly work, it didn't actually instantiate the inner
- Vladimir Panteleev (4/5) May 21 2017 I think it's the same as foo!x!y. As for the reason - I think
- Stanislav Blinov (11/16) May 21 2017 I did encounter that a few times too, and my humble opinion is
- Daniel N (3/21) May 21 2017 I ran into this aswell.
Why is that prohibited? I just wrote template foo(x) { template foo(y) {}} and did foo!(x)!y and it triggered that error. If I comment that line and use the hacked dmd, it seems to work. So why is that error there?
May 21 2017
On Sunday, 21 May 2017 at 13:08:18 UTC, Adam D. Ruppe wrote:If I comment that line and use the hacked dmd, it seems to work.Well, not exactly work, it didn't actually instantiate the inner template like it probably should have. So is it just not implemented correctly and became an error because y'all never got around to fixing the bugs, or is it prohibited by design? If so, why? Is it impossible to implement correctly?
May 21 2017
On Sunday, 21 May 2017 at 13:08:18 UTC, Adam D. Ruppe wrote:foo!(x)!yI 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).
May 21 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: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.foo!(x)!yI 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).
May 21 2017
On Sunday, 21 May 2017 at 14:11:00 UTC, Stanislav Blinov wrote:On Sunday, 21 May 2017 at 13:42:50 UTC, Vladimir Panteleev wrote:I ran into this aswell. Agreed, just an arbitrary restriction.On Sunday, 21 May 2017 at 13:08:18 UTC, Adam D. Ruppe wrote: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.foo!(x)!yI 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).
May 21 2017