@ctfeonly
Johannes Pfau
nospam at example.com
Thu Dec 7 21:54:45 UTC 2017
Am Thu, 7 Dec 2017 13:38:54 -0800
schrieb Walter Bright <newshound2 at digitalmars.com>:
> On 12/6/2017 11:41 PM, Mike Franklin wrote:
> > On Thursday, 7 December 2017 at 04:45:15 UTC, Jonathan M Davis
> > wrote:
> >> The simplest way to do that is to write a unit test that uses a
> >> static assertion. As I understand it, with the way CTFE works, it
> >> pretty much can't know whether a function can be called at compile
> >> time until it tries, but a unit test can catch it if the function
> >> no longer works at compile time.
> >
> > Not bad, but that is swaying into the cumbersome category. If
> > that's the best we can do, a @ctfeonly attribute starts looking
> > pretty good.
>
> More and more attributes to do essentially trivial things is
> cumbersomeness all on its own.
I think this is more of an optimization UDA than a standard attribute.
So it's similar to all the noinline, forceinline, weak, section etc.
attributes: https://wiki.dlang.org/Using_GDC#Attributes
-- Johannes
More information about the Digitalmars-d
mailing list