November 10, 2013 DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is: http://wiki.dlang.org/DIP50 -- /Jacob Carlborg |
November 10, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg:
> http://wiki.dlang.org/DIP50
I suggest to add some more use cases (possibly with their implementation).
Bye,
bearophile
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Sunday, 10 November 2013 at 22:33:34 UTC, bearophile wrote: > Jacob Carlborg: > >> http://wiki.dlang.org/DIP50 > > I suggest to add some more use cases (possibly with their implementation). > > Bye, > bearophile A scalable and elegant solution to the "inspection" problem may be a AST use case. Discussed here: http://forum.dlang.org/thread/qconpedgdkyeawmdzect@forum.dlang.org --rt |
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rob T Attachments:
| <[ .. ]> syntax looks very foreign. How about m{...} (with q{...} as a
precedent)?
On Sun, Nov 10, 2013 at 5:08 PM, Rob T <alanb@ucora.com> wrote:
> On Sunday, 10 November 2013 at 22:33:34 UTC, bearophile wrote:
>
>> Jacob Carlborg:
>>
>> http://wiki.dlang.org/DIP50
>>>
>>
>> I suggest to add some more use cases (possibly with their implementation).
>>
>> Bye,
>> bearophile
>>
>
> A scalable and elegant solution to the "inspection" problem may be a AST use case.
>
> Discussed here: http://forum.dlang.org/thread/qconpedgdkyeawmdzect@forum.dlang.org
>
> --rt
>
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg: > http://wiki.dlang.org/DIP50 It's also useful to take a look at what F# is doing: http://tomasp.net/blog/2013/computation-zoo-padl/index.html Bye, bearophile |
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg Attachments:
| People have shunned proposals to have @mixin functions because it wouldn't be obvious at call site that some statement is executed under a mixin (which could access all variables in scope etc).
The same will happen here; I think it should be clear at call site that a
macro is used.
How about:
macro!myAssert(1 + 2 == 4);
instead of myAssert(1 + 2 == 4);
On Sun, Nov 10, 2013 at 1:20 PM, Jacob Carlborg <doob@me.com> wrote:
> I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is:
>
> http://wiki.dlang.org/DIP50
>
> --
> /Jacob Carlborg
>
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timothee Cour | On 11/11/2013 02:49 AM, Timothee Cour wrote:
> People have shunned proposals to have @mixin functions because it
> wouldn't be obvious at call site that some statement is executed under a
> mixin (which could access all variables in scope etc).
>
> The same will happen here; ...
macros are hygienic.
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 2013-11-10 21:20:30 +0000, Jacob Carlborg said:
> I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is:
>
> http://wiki.dlang.org/DIP50
Not a huge fan of the syntax, but I think it's a step in the right direction away from string mixins.
R/
Shammah
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On 2013-11-11 03:04:34 +0000, Shammah Chancellor said:
> On 2013-11-10 21:20:30 +0000, Jacob Carlborg said:
>
>> I've been thinking quite long of how AST macros could look like in D. I've been posting my vision of AST macros here in the newsgroup a couple of times already. I've now been asked to create a DIP out of it, so here it is:
>>
>> http://wiki.dlang.org/DIP50
>
> Not a huge fan of the syntax, but I think it's a step in the right direction away from string mixins.
>
> R/
> Shammah
I think this would gain a lot more traction if someone wrote an std.expressions which produced workable code from a AST. At that point, it's just for the D-frontend to parse code into said std.expressions.
The .NET expressions framework might servce as some insperation.
R/
Shammah
|
November 11, 2013 Re: DIP 50 - AST macros | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 2013-11-10 23:33, bearophile wrote: > Jacob Carlborg: > >> http://wiki.dlang.org/DIP50 > > I suggest to add some more use cases (possibly with their implementation). I could try and do that. The problem is I have not given much though on how the reflection API and the API used to build syntax trees should look like. If this get any serious interest and we start to think about the implementation I was hoping that someone we more experience could help out with designing the API. -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation