"temporary" templates
Suleyman
sahmi.soulaimane at gmail.com
Mon Dec 2 02:42:55 UTC 2019
On Monday, 2 December 2019 at 02:26:33 UTC, Stefan Koch wrote:
> On Monday, 2 December 2019 at 02:02:04 UTC, Suleyman wrote:
>>
>> Not to this extent though. What we're potentially discussing
>> here is functions which have a reusable body like a runnable
>> template. For example a CTFE function `bool isSame(alias A,
>> alias B) { return __traits(isSame, A, B); }` this is unlike
>> any regular function that we have today.
>
> Interesting this is exactly the syntax I wanted to use ;)
>
> Any ctfe function that has an alias parameter is a ctfe only
> function.
> Using this you can give a function a default alias parameter if
> you want it to be compile time only.
>
> it's a simple rule, and not confusing at all.
It looks like the discardable template but branded as a
function. I guess the plan on each call is to run semantic
analysis to get the result then reset the function to an initial
state.
More information about the Digitalmars-d
mailing list