[Mono-devel-list] overriding return type

Thong (Tum) Nguyen tum at veridicus.com
Sun Jul 27 19:40:01 EDT 2003


Hmm....I don't think it's a good idea to break away from the standard --
and especially not make it default.  The proper way to handle things
like this is to go through ECMA....  IIRC, Miguel is on the committee.
He might be able to bring the issue up at the next meeting.

^Tum


> -----Original Message-----
> From: mono-devel-list-admin at lists.ximian.com [mailto:mono-devel-list-
> admin at lists.ximian.com] On Behalf Of alan jenkins
> Sent: Monday, 28 July 2003 4:13 a.m.
> To: Mono-devel-list at lists.ximian.com
> Subject: [Mono-devel-list] overriding return type
> 
> >> I guess this thread is finished then
> <cringe>
> 
> I have examined the compiler source, and the only thing which prevents
the use
> of covariant return types is
> 
> mcs/class.cs(2316) : void Method.CheckBase(TypeContainer container)
> 
> It is trivial to alter the method to allow covariant return types, and
only
> complain when the return type of the overriding method can't be
implicity
> cast to the original return type.  This doesn't seem to break anything
- the
> class library compiles fine using the modified compiler.  Assemblies
> containing methods with covariant return types (compiled with the
modified
> compiler) can be referenced from assemblies compiled with the original
> compiler (e.g. mono_new covariant.cs; mono_old -r covariant.exe
old.cs).
> 
> As an alternative to requiring an option to enable it, it might be
better to
> have the feature enabled by default, but emit warnings about the
portability
> of the C# code when covariant return types are encountered.
> 
> I ask the list again:  would you be willing to see the compiler
changed in
> such a way?  It appears to be a trivial piece of code which would
break
> nothing.
> 
> Um... I think I could write the patch myself - it'd only be about 20
lines of
> code in the compiler, plus a test, but I am an absolute C# & Mono
newbie.
> Though I would like to think I could work with large projects without
> stepping on other peoples toes, I haven't actually contributed to a
project
> before.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list





More information about the Mono-devel-list mailing list