[nem-en] Operator overloading on external types

vc vc at rsdn.ru
Wed Jun 13 16:25:35 CEST 2007


> I thought that there was a similar check as in C# - one of parameters
> (or return type?) must be the same as current class...

Yes. This code:
class B { }

class A
{
	public static implicit operator B (int x)
	{
		return new B();
	}
}
in C# cause:
error CS0556: User-defined conversion must convert to or from the enclosing
type

But, this behavior is cool :).

If you fix this bug:
http://nemerle.org/bugs/view.php?id=1026
of course...

> 2007/6/13, vc <vc at rsdn.ru>:
> > > vc wrote:
> > > > This is expected behavior?
> > > Quite a useful feature, I'd say.
> >
> > Yes. I agree with you. But, unfortunately, it feature cause a bug:
> > http://nemerle.org/bugs/view.php?id=1026
> >
> > Vlad
> >
> >
> > _______________________________________________
> > https://nemerle.org/mailman/listinfo/devel-en
> >
> 
> 
> --
> Kamil Skalski
> http://nazgul.omega.pl
> 
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en




More information about the devel-en mailing list