[nem-en] importing extension methods
Michal Moskal
michal.moskal at gmail.com
Wed Feb 1 08:07:37 CET 2006
Hi,
I started implementation of extension methods. They work for
non-generic types (this also excludes arrays). They can be saved and
loaded from assemblies.
What we need now is support for generic types (this shouldn't be
hard), and a way of enabling only certain extension methods.
People here suggested to make 'using Namespace.Class' enable
extensions from Namespace.Class. I don't like this idea, because it
clutters your global namespace with stuff that should be scoped to the
extended type. That is you don't always want to be able to say
Split(some_array,1,2) in addition to some_array.Split(1,2).
This is why I think C# used the 'using Namespace' only. This again
cluters your global namespace with strange stuff, but this time you
were likely to do it anyway.
The problem is that 'using' has nothing in common with extension
methods, it just happen to coincide in most cases.
The cleanest solution would be to use 'import Namespace.Class' and
'import Namespace.*' but this seems overkill...
So in the end I'm not sure how to resolve this. Waiting for your comments.
--
Michal Moskal,
http://nemerle.org/~malekith/
More information about the devel-en
mailing list