December 02, 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.

December 02, 2019
On Monday, 2 December 2019 at 01:10:26 UTC, Steven Schveighoffer wrote:
> On 12/1/19 4:04 PM, Suleyman wrote:
>> Perhaps this is the opportunity to make a good runtime reflection system. We have typeid() for types, for an alias sequence which contains only types an no declarations we can implement NoDuplicates as a function that takes a TypeInfo[] and return the array with no duplicates in it, but we need a way to get a compile-time type from a TypeInfo, sort of a reversed typeid()
> I actually figured out a Type-only mechanism to CTFE a NoDuplicates list. Translate each type into a string name, then no-dup the string array, creating a string of AliasSeq references, then mixin the result.
>
> But having CTFE actually give me the types to translate back into an AliasSeq list would be so much better.
>
> -Steve

I had a similar idea for optimizing NoDuplicates, as used by std.typecons.Tuple:

https://github.com/dlang/phobos/pull/5725#issuecomment-327767020

;)

1 2 3
Next ›   Last »