First life-signs of type functions
Steven Schveighoffer
schveiguy at gmail.com
Tue May 12 17:30:42 UTC 2020
On 5/12/20 12:20 PM, Stefan Koch wrote:
> On Tuesday, 12 May 2020 at 16:12:42 UTC, Steven Schveighoffer wrote:
>
>> to force a type function instead of using CTFE when you want to
>> manipulate a compile-time list of strings.
>>
>> It reminds me of what people would resort to for a static foreach over
>> a tuple when all they wanted was the index (before static foreach
>> existed).
>>
>
> There is no essentially no difference between a type function and CTFE.
> Type functions are really just passing type as expressions to CTFE.
> Well that and the ability to assign to alias.
> Having a dummy alias parameter just means ctfeOnly.
>
Right. What I meant was, a function that is intended ONLY to be used for
ctfe could put in a dummy parameter, or they could take the string array
as an alias[] (if it's supported), and have it support more than just
string arrays.
It would be awkward and confusing to have a different set of functions
or constructs to deal with type lists than ones that deal with values
(or mixed lists). Not only that, but it's also odd for aliases to work
differently here than they do in templates.
-Steve
More information about the Digitalmars-d
mailing list