Internal and external iteration, fibers

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jan 21 22:07:47 PST 2013


On Tue, Jan 22, 2013 at 06:51:07AM +0100, Philippe Sigaud wrote:
> On Tue, Jan 22, 2013 at 2:55 AM, deadalnix <deadalnix at gmail.com> wrote:
> > On Monday, 21 January 2013 at 19:23:19 UTC, Jacob Carlborg wrote:
> 
> >> I know people don't like it but I have to say, this seems it could
> >> be a job for AST macros.
> >
> > I was thinking the same thing, but don't wanted to bug people.
> > Indeed, it is the perfect job for AST macro. I can concur now that
> > you mentioned it xD
> 
> Would any of you be so kind as to propose another definition for AST
> macros here ?
> 
> http://wiki.dlang.org/Commonly-Used_Acronyms

I don't think anyone has defined what "AST macros" are supposed to be
yet. There have been some vague ideas thrown about, but nothing is
concrete AFAIK.

For one thing, it's not even clear how said "AST macros" are supposed to
work, or what they're supposed to do.

Do they perform *arbitrary* transformations from some given AST subtree
into another? (Arbitrary, as in, you can implement an "in-library"
optimizer that substitutes inefficient subtrees with optimized versions,
or even a codegen that transforms AST trees into a linear form that maps
directly to IR or machine code.)

Or is it something simpler and more within our reach, something like the
C preprocessor but operating on AST subtrees instead of tokens (as in, a
macro is called with some AST tree fragments as parameters, which get
grafted into the macro body's AST at certain points)?

Or is it something else altogether, like some kind of compile-time
introspection that allows you to access and modify node attributes in
the parsed AST of the code in some way, so that you change the way it's
compiled?

Until this is pinned down, "AST macros" can virtually be *anything*. It
has been said that they can solve all kinds of problems in D, including
the halting problem, world peace, and world hunger, and can be used to
construct all manner of amazing features like writing your code for you,
implementing an oracle machine, etc..  But nobody even knows what they
are or how they're supposed to work.


T

-- 
Freedom: (n.) Man's self-given right to be enslaved by his own depravity.


More information about the Digitalmars-d mailing list