Which language constructs could be done as a library if we accept some breaking changes?
Paul Backus
snarwin at gmail.com
Thu Dec 2 14:38:21 UTC 2021
On Thursday, 2 December 2021 at 09:20:26 UTC, Ola Fosheim Grøstad
wrote:
> On Thursday, 2 December 2021 at 00:58:38 UTC, 12345swordy wrote:
>> On Wednesday, 1 December 2021 at 15:09:28 UTC, Ola Fosheim
>> Grøstad wrote:
>>> On Wednesday, 1 December 2021 at 15:01:10 UTC, 12345swordy
>>> wrote:
>>>> What you basically are asking for is C with ast macros.
>>>
>>> Can you emulate D as C with AST macros?
>>
>> https://github.com/eudoxia0/cmacro
>
> That would be a different language. Templates are related to
> AST macros, but they are limited to expanding on"!".
The syntax used for macro expansion is a trivial detail. Rust has
"real" AST macros, and they also use `!` for expansion (`vec!`,
`println!`, etc.).
The biggest difference between AST macros and templates is that
expanding a template both *generates* code and *binds* that code
to a symbol in a particular scope.
More information about the Digitalmars-d
mailing list