[nem-en] Macros and extension methods

Kamil Skalski kamil.skalski at gmail.com
Fri Jun 9 17:21:02 CEST 2006


Probably the problem is that you don't have 'using System.Query;'
specified in the place the macro is defined. Remember, that the global
context is taked from the place where you write the macro, not from
the place it is expanded.

2006/6/9, Alejandro Serrano <trupill at yahoo.es>:
> Hi,
> I'm trying to learn a bit about macros. I've coded the following macro:
>
>   macro Example (item)
>   {
>     <[ ($item).Select (fun (x) { x > 2 }) ]>
>   }
>
> and then used it in code:
>
> def ls = System.Collections.Generic.List ();
> ls.Add (1);
> ls.Add (2);
> ls.Add (3);
> def t = Example (ls);
>
> but the compiler complains: "there is no member named `Select' in
> System.Collections.Generic.List[int] with type ?", even though I've
> added a reference to System.Query.dll and "using System.Query;" at the
> top of the file. It works completely fine without the macro (I mean,
> writing "ls.Select ...").
> Is the macros engine some how not usable along with extension methods?
>
> Thanks in advance
>
>
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


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


More information about the devel-en mailing list