Introduction to programming with compile time sequences in D

data pulverizer data.pulverizer at gmail.com
Tue Sep 1 16:00:14 UTC 2020


On Saturday, 29 August 2020 at 04:41:36 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Friday, 28 August 2020 at 11:05:09 UTC, data pulverizer 
> wrote:
>> On Tuesday, 25 August 2020 at 15:58:46 UTC, Petar Kirov 
>> [ZombineDev] wrote:
>>> [...]
>>
>> Just to keep you updated, I've begun to write a fresh section 
>> on templates for dlang-tour quite separate from the blog 
>> article - something more appropriate for the website, though 
>> I'll take some elements of what I've already done. Once it's 
>> finished I'll do a pull request.
>>
>> Thanks
>
> Sounds great, thank you!

I've finished writing the fresh section and checked it through a 
few times. It is pretty detailed and long and before releasing it 
and doing a pull request I'll check it through once or twice more 
over the next day or two. The document content structure is:

```
# Templates and Compile Time Programming in D

## Contents

* Introduction
* Templates in D
   * Function templates
     * Longhand and shorthand declarations
     * Inference of parameters
     * Access patterns for template internals
     * Alias template parameter
     * Variadic template functions
     * The is() directive
     * More on template constraints and partial specialization
   * Struct, class, and interface templates
     * Struct template longhand and shorthand declarations
       * Variadic template objects
       * Template constraints and specialization
   * Enumeration templates
   * Alias templates
     * static if
     * Traits
* Metaprogramming in D
   * Introduction
   * AliasSeq!(T) compile time sequences
     * Append, prepend and concatenating compile time lists
     * Replacing items in compile time sequences
     * Replacing multiple items with an individual type
       * String mixins
       * static foreach
     * Replacing multiple items by a tuple of items
       * Contained type sequences
     * Template mixins, CTFE, and import
       * Template mixins
       * CTFE
       * import("file.d")
```

I have written lots of code examples in the text but there are 
also lots of runnable files that can be in code demo "play" 
sections. The only thing is when I look at the current coding 
area it is quite large and separate from the text. Sometime in 
the future, I guess it would be great to have it inline with the 
text and smaller like the regular fenced code so that multiple 
files can be included in separate scrollable "play" areas.

Thanks


More information about the Digitalmars-d-announce mailing list