feature request: __ARGS__ for logging (cf __FILE__, __LINE__, __FUNC___)
Jacob Carlborg
doob at me.com
Tue Feb 5 23:48:35 PST 2013
On 2013-02-05 12:05, Timon Gehr wrote:
> As far as my understanding goes, quasi-quoting is hygienic, and manual
> AST building provides both options.
Yes, that's usually how it works.
> We could provide all nested scopes in an array as part of the context.
>
> macro foo(Context context){
> return<[
> context.scopes[0].x++;
> context.scopes[1].x++;
> ]>;
> }
> int x = 2;
> void main(){
> int x=0;
> foo();
> assert(x==1 && .x==3);
> }
How would one navigate these scopes. How would one know which one to
use? If I recall correctly Nemerle has a way to indicate a symbol should
refer to a symbol at the call site which has the closest lexical scope.
We would need a way to introduce a new symbol which does not leak
outside the macro and another way to explicitly say the symbol is
available outside the macro at call site.
So if I do something like:
int x;
macro foo (Context context)
{
int y;
return <[
x++;
y++;
]>;
}
The above would increment "x" and "y" available in the macro context and
not refer to any symbols at the call site?
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list