[nem-en] About macro

Kamil Skalski kamil.skalski at gmail.com
Fri Feb 2 11:05:30 CET 2007


I guess a good start would be to look into implementation of Late macros:
http://nemerle.org/svn/nemerle/trunk/macros/Late.n

But you seem to have a little bit different need - you have the full
signature of method, and would like to generate some code basing of
the additional info from compiler about this one.
To do this, you need:
- use BindType method to type signature
- fetch methods from target class
- search method with given signature among fetched methods

Unfortunately most of this needs searching for useful API in compiler.

2007/2/2, Vladimir Reshetnikov <v.reshetnikov at gmail.com>:
> I want to implement the following feature:
>
> [nemerle]
> public module A
> {
>         public Foo(x : int, y : string) : void {}
>         public Foo(x : int, y : object) : void {}
> }
>
> def info = infoof(A.Foo(int * string)); /* infoof - new feature */
> [/nemerle]
>
> that would be equivalent to
>
> [nemerle]
> public module A
> {
>         public Foo(x : int, y : string) : void {}
>         public Foo(x : int, y : object) : void {}
> }
>
>
> def info = typeof(A).GetMethod(
>     "Foo",
>     System.Reflection.BindingFlags.Public |
> System.Reflection.BindingFlags.Static,
>     null,
>     System.Reflection.CallingConventions.Standard,
>     array[typeof(int), typeof(string)],
>     null);
> [/nemerle]
>
> but with compile-time check that the target method exists.
>
> Can Nemele macro help me with it?
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


-- 
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list