[nem-en] ManagerClass.Instance == pain!
vc
vc at rsdn.ru
Sun Nov 19 02:15:04 CET 2006
> you would need to transform the Utility module to take the context into
> account:
>
> macro Generate (specification1, specification2) {
> def code1 = Utility.Generate1 (Macros.Manager(), specification1);
> def code2 = Utility.Generate2 (Macros.Manager(), specification2);
> <[ $code1 + $code2 ... ]>
> }
>
> module Utility {
> public Generate1 (mgr:ManagerClass, expr : PExpr) : PExpr { ...
> }
> private myUtil (mgr:ManagerClass, expr:PExpr):PExpr { }
> ...
> }
>
> and pass it everywhere...
We can put context into [ThreadStatic]-variable. It variable can be
initialized before macro running. Macro can't call another code in another
context.
> It would break literally ALL existing code.
We simply convert Utility to [ThreadStatic]-variable.
> The need to pass context around is quite disturbing in my opinion...
> Every time you would like to create simple Location or PExpr object
> you need to have ManagerClass at hand... Of course we could force
> users to do this and fix all code in nemerle sources, but the question
> is if it is really worth all the costs?
Static nature of compiler make many pain now and in the future (when the
compiler will be released). I vote on convert compiler for truly instance
base.
More information about the devel-en
mailing list