Metaprogramming without templates

Stefan Koch uplink.coder at googlemail.com
Mon Jun 21 13:18:21 UTC 2021


On Monday, 21 June 2021 at 12:39:25 UTC, SealabJaster wrote:
> On Sunday, 20 June 2021 at 22:51:06 UTC, Stefan Koch wrote:
>> ...
>
> If something like this gets through, would this allow things 
> like converting range queries into SQL, for example, like how 
> Entity Framework allows?
>
> e.g. You can convert `db.people.filter!(p => p.isMale)` 
> directly into a prepared statement similar to `SELECT * FROM 
> people WHERE isMale = TRUE`?

Hmm yes I think so.
But the user-code for this would look quite horrid since you have 
to match a particular templates and so forth.
Also you cannot change the meaning of code that comes in.
So in that sense they're not actual macros.
You can however generate a new function/module which is exactly 
like the one you reflected on except that you do a SQL query 
rather than using the template.



More information about the Digitalmars-d mailing list