On Wednesday, 3 October 2018 at 07:57:07 UTC, drug wrote:
According to https://dlang.org/articles/ctarguments.html
compile time sequences "...allow a programmer to operate on
types, symbols and values..."
Phobos has `isType`/`isTypeTuple` traits, also `isExpressions`
where expression may contain both values and symbols, but has
no traits like `isSymbol` and `isValue`. I handle this by
taking an address - values has no address, so I can distinct
types, symbols and values, but it's not convenient/consistent
way. I think it worths to add such traits, but probably I
missed something?
In my experience doing metaprogramming in D, it's best to make
your static if/template constraint tests as narrow and specific
as possible. For example, if you want to know whether you can
call a function with a particular argument, you don't need to
muck around with std.traits; you can just check whether the
function call compiles:
static if(__traits(compiles, f(arg))) {
// do something with f(arg)
}
So my question to you is: why do you care whether something is a
symbol or a value? Is there actually a more specific question
that you're trying to answer with that information? If so, just
ask the more specific question directly.