On 11/6/2012 8:04 AM, Johannes Pfau wrote:> The std.benchmark proposal currently requires all benchmark functions to
> be named "benchmark_name":
>
> void benchmark_stdio_write_test() {}
>
> with UDA:
>
> @benchmark("stdio write test") void benchStdioWrite();
>
> Of course you still need that "sheduleBenchmarks" mixin in every module
> and of course it'd be nice to avoid that. But UDAs are already a big
> step forward.
>

Consider that you can use a tuple generated elsewhere for a UDA:

[tp] void foo();

where tp is a tuple. You can even grab the attributes from another symbol, turn them into a tuple, and apply the tuple as an attribute to a new symbol. Tuples can, of course, be sliced and concatenated.

In other words, by using tuples, you can "encapsulate" what the attributes expand to in the same way you can change target code by changing the definition of user defined types.

Reply via email to