Beyond the veil: What's after type functions
Paul Backus
snarwin at gmail.com
Wed Jan 6 16:58:30 UTC 2021
On Wednesday, 6 January 2021 at 16:34:14 UTC, Ola Fosheim Grøstad
wrote:
> On Wednesday, 6 January 2021 at 16:30:25 UTC, Jacob Carlborg
> wrote:
>> On 2021-01-04 20:30, Stefan Koch wrote:
>>
>>> With this in mind, please tell me what you think :)
>>
>> I think this looks like yet another new set of features just
>> to avoid AST macros. What everyone is currently doing is
>> inventing many highly specialized features just in the name of
>> avoiding AST macros, regardless of the cost.
>
>
> But the DMD AST model isn't really suitable for exposure. So
> you would need to design a completely new AST... not sure if
> this is feasible in this decade? :)
You don't need a stable AST API for AST macros, you just need
quasi-quoting and unquoting, à la Common Lisp. There's an old
talk by Walter and Andrei that includes a sketch of what AST
macros might look like in D [1], which contains the following
example:
macro foo(e) { e = 3; }
In Common Lisp, the equivalent would be
(defmacro foo (e) `(setf ,e 3))
You will notice that nowhere in either example is the AST exposed
directly.
[1] https://www.youtube.com/watch?v=FRfTk44nuWE&t=1h5m37s
More information about the Digitalmars-d
mailing list