[Issue 17487] CTFE should allow casting delegate function attributes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 9 13:11:57 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17487
Eyal <eyal at weka.io> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://issues.dlang.org/sh
| |ow_bug.cgi?id=17486
--- Comment #1 from Eyal <eyal at weka.io> ---
I have a specific use-case:
assertOp!"<="(x, y);
I want x/y to be lazy so I can disable the assert at runtime (and avoid costs
of computing x,y). I also want any exceptions computing x,y to be caught by
assertOp.
I also need assert functions (including this one) to be @nogc but this is not
directly supported due to (https://issues.dlang.org/show_bug.cgi?id=17486).
So I need to use a delegate cast to achieve the combination of @nogc and lazy
params. This rules out any function that indirectly uses assertOp from ctfe,
which is sad.
if(__ctfe) could skip the asserts altogether, but that loses a lot too.
--
More information about the Digitalmars-d-bugs
mailing list