[Mono-list] mcs won't allow implementation of interfaces withstatic methods

Serge serge@wildwestsoftware.com
Fri, 16 Aug 2002 14:06:48 +0300


> C# code won't be able to call them, so it should just ignore their
> existance.

It seems that at present, it's possible to _call_ those methods (without implementing interface).
But, MCS generates correct code, while CSC produces wrong binary
(something like 'pop' instead of a 'call') without reporting any errors.

Sergey



----- Original Message ----- 
From: "Paolo Molaro" <lupus@ximian.com>
To: <mono-list@ximian.com>
Sent: Friday, August 16, 2002 12:43 PM
Subject: Re: [Mono-list] mcs won't allow implementation of interfaces withstatic methods


> On 08/16/02 Jeroen Frijters wrote:
> > I disagree, while C# doesn't allow static interface declarations, that
> > doesn't mean C# should be unable to implement interfaces from other
> > languages that do add static methods to interfaces. There is nothing in
> > the C# language specification that forbids that. You don't support
> > static methods in interfaces, so just ignore them. Besides, the current
> > error message is incorrect, fixing the compiler is less effort than
> > fixing the error message ;-)
> 
> I agree with Jeroen here: C# can't use all the features in mscorlib
> (for example the varargs methods in System.String and System.Console),
> still it can use the other methods provided by those classes.
> The issue is exactly the same for static methods in interfaces:
> C# code won't be able to call them, so it should just ignore their
> existance. Of course, the C# compiler can't generate them, too:
> if somebody wants static members in interfaces he'll have to do them in
> IL code or whatever language allows him to do that.
> 
> BTW: the mono runtime will need a small fix to allow static data on
> interfaces, I'll do that when someone posts a sample in bugzilla.
> 
> lupus
> 
> -- 
> -----------------------------------------------------------------
> lupus@debian.org                                     debian/rules
> lupus@ximian.com                             Monkeys do it better
>