On Sat, 07 Apr 2012 12:48:00 -0400, Jacob Carlborg <[email protected]> wrote:
On 2012-04-07 05:29, Kapps wrote:
I slightly prefer this function method over the struct method because:
1) No need to generate a custom struct for everything. Plenty of things
are just a true or false, or a string. Saves a little bit of TypeInfo
generation.
But you still need to create a function.
functions are easier for the linker to deal with. The main point here is,
no TypeInfo needed.
2) The more important one: The possibility to eventually include an
alias template parameter. This allows things like looking up whether the
symbol with the attribute has other attributes applied, or determining
type. This allows things like constraints, and can be a nice benefit.
This can't be done for structs?
IFTI. It possibly can be added to struct ctors (I argue it should be),
but is not today.
I think the struct approach is fine for some attributes, and I think it
should be doable to @attribute either functions or structs. I just want
the most generic, basic feature possible. I think Timon has the best idea
that any callable CTFE symbol should be able to be an attribute.
At this point it has become a "structs are a good solution, why not also
allow functions?" argument.
-Steve