What type functions mean on a language level

Jacob Carlborg doob at me.com
Wed Jan 6 16:35:45 UTC 2021


On 2021-01-06 14:56, sighoya wrote:

> Reminds me on Scala macros.

Yes, that's the main inspiration. See DIP 50 [1].

> Yes it would be nice, but is it likely to get them in D?

Extremely unlikely.

> If we're allowed to read any source code from our project, we could 
> write our own macro framework to parse strings of code though the work 
> is doubled as they have to be expanded and re-parsed again by the compiler.

Yes, that's possible in theory. DMD could be used as a library to 
achieve this. The problem is that DMD doesn't contain enough source code 
location information to do source code refactoring. Also, it doesn't 
help that the analysis the compiler performs is destructive.

https://wiki.dlang.org/DIP50

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list