|
| <prev next> |
macros attached to methods: msg#00000lang.nemerle.devel
Hi, we have an issue report about implementing macros attached to particular methods. They should be run, when a given method is selected in overload resolution. The original rationale was to allow implementing extension methods with this. However we now have extension methods anyway. I'm not sure how such feature would work and when would it be useful? One use I can think of is implementing .Keys or .Range property in array (and possibly other types), that could be used in foreach iterations, it would return $[0 .. a.Length - 1]. So the use would be: foreach (i in a.Keys) a[i] = a[i] * 2; Unfortunately this won't gonna fly -- the macro would be expanded too late for @foreach macro to realize the collection iterated is a range, and therefore a specialized code should be used. Maybe if we could use some more complicated constraints to delay parts of macro execution, but this doesn't seem simple. Anyway it seems worthwhile to implement such a keys or range macro in N.Collections. Any other ideas when macros attached to methods would be useful? Anyone? -- Michał
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Next by Date: | extension methods for local function., mei |
|---|---|
| Next by Thread: | Re: macros attached to methods, Kamil Skalski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |