DIP 50 - AST macros

Yota yotaxp at thatGoogleMailThing.com
Tue Nov 19 10:05:32 PST 2013


On Tuesday, 19 November 2013 at 13:10:44 UTC, Dicebot wrote:
> On Monday, 18 November 2013 at 22:47:59 UTC, Timon Gehr wrote:
>> So you oppose macro attributes?
>
> Yes. For me proper "macro attribute" is just an UDA that can be 
> used by macro to tweak code generation. Actually I think I'd 
> oppose a very large part of this specific DIP when it comes to 
> exact syntax and usage models - I am more interested in "AST" 
> than in "macro" part.

This topic really took off.  I'm afraid to say that I've only 
gotten through about half of it so far.

I noticed computation expressions were mentioned, but has anyone 
by chance noted this little-known feature of F#?  It sounds 
exactly like what is being proposed here.
http://msdn.microsoft.com/en-us/library/vstudio/dd233212.aspx

I don't believe I've ever seen F#'s code quotations being used in 
real code.  But then again, F# doesn't have CTFE or code mixins.

The LINQ sample in the DIP kinda rubs me the wrong way.  LINQ 
query syntax (and for that matter, F# computation expressions) 
does not generate imperative code, but rather a chain of 
extension methods.  More importantly, it does not eagerly chomp 
through all the data.  It runs on IEnumerable, and is therefore 
lazy. (Like D ranges.)  I wouldn't mind, however, if I saw these 
macros generate state machines specifically made for a given 
query.


More information about the Digitalmars-d mailing list