Enum and Function Parameters Attributes -- No DIP Required
arturg
var.spool.mail700 at gmail.com
Thu Apr 12 13:48:54 UTC 2018
On Thursday, 12 April 2018 at 08:28:17 UTC, Mike Parker wrote:
>
> Around the same time, a Pull Request was created to implement
> support for UDAs on function parameters [4]. In the comment
> thread for this PR, Andrei said that he and Walter "agree this
> can be integrated without a DIP." When he realized a DIP had
> already been submitted, he wanted to approve it "without too
> much paperwork."
>
> [4] https://github.com/dlang/dmd/pull/7576
will templates be supported?
dont know, maybe something like this example:
void test(T)(T t) { }
void test2(Args...)(Args args) { }
void main()
{
// uda declaration as a ct-param
test!(@(1) int)(1);
test2!(@(1) int, @(2) string)(1, "test");
test!(@(1))(1); // inferred type but provided uda?
1.test!(@(1) int);
1.test2!(@(1) int, @(2) string)("test");
1.test!(@(1)); // inferred type but provided uda?
// or alternatively as a rt-param
test(@(1) 1); // inferred type but provided uda?
(@(1) 1).test;
test2(@(1) 1, @(2) "test");
test!(int)(@(1) 1);
test2!(int, string)(@(1) 1, @(2) "test");
}
More information about the Digitalmars-d-announce
mailing list