D parsing

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Nov 10 17:54:37 PST 2013


On 11/10/13 5:03 PM, Timothee Cour wrote:
> On Sun, Nov 10, 2013 at 3:37 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
> wrote:
>
>     On 11/10/13 3:21 PM, Timon Gehr wrote:
>
>         On 11/10/2013 11:43 PM, Andrei Alexandrescu wrote:
>
>
>                 It seems we could even get rid of
>                 __FILE__,__LINE__,__MODULE__ with AST
>                 macros.
>
>
>             This would be a very small advantage. The special variables
>             hardly cause
>             any trouble.
>
>             Andrei
>
>
>         The trouble is that there are too few of them to (efficiently)
>         reflect
>         all the information about the calling context one may be
>         interested in.
>         I don't see the point in adding them one after another in an
>         unprincipled ad-hoc fashion instead of actually thinking up a
>         good API
>         coupled with some more expressive power.
>
>
>     But the API would add them in exactly the same rote manner. I really
>     don't see an advantage here.
>
>
> All else being equal, a library solution is always preferable; and it's
> easily extensible unlike what we have.

What do you have in mind? I find it difficult to grab e.g. the file and 
the line unless there's some plumbing in the language that allows you to.

>     An argument for macros would have to do a lot more than "we don't
>     need __FILE__ etc. anymore".
>
>
> More use cases have already been provided in this thread and previously.
> The fact that *one* language feature enables all of those is a very good
> indication there'll be more use cases. Furthermore, writing AST macros
> instead of mixins is cleaner in terms of introspection, refactoring
> tools, etc.

I am aware of the advantages. You, too, should be aware of the 
disadvantages.


Andrei




More information about the Digitalmars-d mailing list