"temporary" templates

Steven Schveighoffer schveiguy at gmail.com
Mon Dec 2 01:11:57 UTC 2019


On 12/1/19 4:14 PM, Suleyman wrote:
> On Wednesday, 27 November 2019 at 20:02:52 UTC, Stefan Koch wrote:
>> On Wednesday, 27 November 2019 at 16:32:13 UTC, Steven Schveighoffer 
>> wrote:
>>> On 11/27/19 11:15 AM, Steven Schveighoffer wrote:
>>>
>>> The more I think about it, the more I like the CTFE with Types as 
>>> first class approach, because then I can use actual mutating code vs. 
>>> immutable functional approach that is required with templates.
>>>
>>> -Steve
>>
>> Yes that is the point.
>> first class types during ctfe allows you to use weak purity instead of 
>> strong purity!
>> And therefore makes AST manipulation or introspection much more 
>> efficient!
>>
>> I'll build a tiny POC shortly. The thing that I got stuck with last 
>> time was the lexer/parser modification that is required to flag type 
>> arguments to ctfe functions.
> 
> The problem with going the path of giving super powers to CTFE functions 
> is that it creates a division between runtime and CTFE then we will get 
> functions which only work in CTFE which may or may not be a good thing.

We already have CTFE-only functions (assert(__ctfe)) Sometimes CTFE is 
far preferable to using template expansion.

-Steve


More information about the Digitalmars-d mailing list