Tuples, CTFE, and Sliding Template Arguments

Nickolay Bukreyev buknik95 at ya.ru
Sun Jan 14 07:56:45 UTC 2024


On Friday, 12 January 2024 at 23:10:08 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> I started working on an alternative mechanism to templates for 
> 1036e yesterday. Which I alluded to.
>
> Being able to pass a UDA at a call site and be able to get 
> access to it via ``__traits(getAttributes, parameter)`` within 
> the (templated) function.
>
> ``i"$ident$(expr)$(ident:format)${1:format}"``
>
> becomes
>
> ```d
> @IExpression("ident")
> ident,
> @IExpression("expr")
> expr,
> @IExpression("ident")
> @IFormat("format")
> ident,
> @IFormat("format")
> @IPosition(1)
> IPosition.init
> ```
>
> This would be a general purpose language feature.

Your idea looks attracting to me, but to be honest, I haven’t 
fully grasped it. Could you show an example implementation of 
`execi` & `generateSql` please? Particularly interested in how 
you would pass and process literal text chunks.


More information about the Digitalmars-d mailing list