Semantics of mixed CT and RT statements
Neia Neutuladh
neia at ikeran.org
Sun Dec 23 02:58:30 UTC 2018
On Sun, 23 Dec 2018 00:52:23 +0000, Timoses wrote:
> The point is that
>
>> if ((is(T == SomeType)) || (b))
>
> misses the point of statically generating content IN CASE a condition is
> true at compile time.
An optimizer can very easily optimize this:
// T is SomeType
if (is(T == SomeType) || b) doStuff;
to remove the if statement. So from that perspective, no need to worry
about it.
The sticky bit is that a runtime check needs both paths to typecheck, so
if you're mixing metaprogramming with runtime logic, some cases might be
weird.
I've never needed to do that.
More information about the Digitalmars-d
mailing list