Blog Post: Beating std::visit Without Really Trying
Adam D. Ruppe
destructionator at gmail.com
Sun Oct 6 14:08:07 UTC 2019
On Sunday, 6 October 2019 at 07:18:37 UTC, Joseph Rushton
Wakeling wrote:
> Speaking of performance, I was intrigued by the Reddit response
> noting that Rust can go one better by eliminating the error
> path at compile time:
D can eliminate error paths at compile time too, e.g. static
assert - which can be used to create all kinds of new useful
errors. So I am guessing this is just a case of the code needing
a lil tweak or the compiler being conservative and putting the
code in even though it is never supposed to happen (like final
switch keeps an error path because you can do like
cast(some_enum) value_not_in_enum.... and then better to have the
assertion failure than UB.)
More information about the Digitalmars-d-announce
mailing list