Discussion:
yield,(un)checked macros
Dmitry Ivankov
2007-06-23 16:01:45 UTC
Permalink
Following macros won't work:

macro MyYield (expr = null)
syntax ("MyYield", expr)
{
<[ yield $expr ]>
}

It fails to expand, because first it expands into "yield $expr", and then
immediately to hacky dont_use_me, without being intercepted by Typer.
This case can be fixed by creating non-recursive
MacroRegistry.expand_single_macro and fixing Typer.TypeExpr call to
expand_macro.
But expand_macro is also used in PrettyPrint.SprintExpr and
Macros.TraverseExpr, how should these methods interact with
yield,checked,unchecked macros?
Kamil Skalski
2007-06-24 07:21:28 UTC
Permalink
I think that we should actually use some nicer pattern than those
hacky "intercepted macros" - maybe it should be additional node in
TExpr or reusing some existing one with indicator that node "special".

Otherwise the recursive expansion would need to be indeed moved to
Typer.TypeExpr, but I think rest of expand_macro uses should stay as
they are.
Post by Dmitry Ivankov
macro MyYield (expr = null)
syntax ("MyYield", expr)
{
<[ yield $expr ]>
}
It fails to expand, because first it expands into "yield $expr", and then
immediately to hacky dont_use_me, without being intercepted by Typer.
This case can be fixed by creating non-recursive
MacroRegistry.expand_single_macro and fixing Typer.TypeExpr
call to expand_macro.
But expand_macro is also used in PrettyPrint.SprintExpr and
Macros.TraverseExpr, how should these methods interact with
yield,checked,unchecked macros?
_______________________________________________
https://nemerle.org/mailman/listinfo/devel-en
--
Kamil Skalski
http://nazgul.omega.pl
Loading...