[nem-en] Re: Problems with covariance

Andrey Khropov andrey.khropov at gmail.com
Sun Jan 28 21:19:36 CET 2007


Kamil Skalski wrote:

> [nazgul at lilith testsuite]$ cat t.n
> interface I[T] { Foo() : T }
> class A : I[object] {
>   public Foo() : string { "" }
> }
> 
> def x = A() : I[object];
> System.Console.WriteLine(x.Foo());
> [nazgul at lilith testsuite]$ mono ../out.stage3/ncc.exe t.n
> [nazgul at lilith testsuite]$ mono out.exe
> 
> [nazgul at lilith testsuite]$ mono --version
> Mono JIT compiler version 1.2.2, (C) 2002-2006 Novell, Inc and
> Contributors. www.mono-project.com
>        TLS:           normal
>        GC:            Included Boehm (with typed GC)
>        SIGSEGV:       normal
>        Disabled:      none

Ok, this was my misunderstanding, I thought it was a bug in the runtime not
System.Reflection.Emit. So I ran .NET 2.0-generated assembly using Mono and got
an error. Mono-generated assembly works fine with both .NET and Mono runtimes.

> > 
> > Well, MS.NET 3.0 is just a new set of libraries, no runtime/core libs
> > changes.
> 
> This is a bug in MS.NET Reflection Emit, which we found before .NET
> 2.0 release. They fixed it one year ago and said that it will be
> included in next release. I think that changing major version number
> IS a "next release".

But MS guys don't think so :-) :

[quote]
How .NET Framework 3.0 Relates to .NET Framework 2.0 and Earlier

The .NET Framework 3.0 adds new technologies to the .NET Framework 2.0, which
makes the .NET Framework 3.0 a superset of the .NET Framework 2.0. You can
think of .NET Framework 3.0 as an "additive" release to the .NET Framework 2.0,
as contrasted with a generational release where software is revised across the
board. (For example, the .NET Framework 2.0 was a generational release over the
.NET Framework 1.0.)

Because .NET Framework 3.0 is an additive release and uses the core run-time
components from .NET Framework 2.0, it is completely backward compatible with
the earlier version. Your existing .NET Framework 2.0 based-applications will
continue to run without any modifications and you can safely continue your
investments using the technologies that shipped with .NET Framework 2.0.
[/quote]
(http://msdn2.microsoft.com/en-us/library/aa480198.aspx)

and I can confirm that (I have .NET 3.0 distributive installed on my Win XP SP2
box)

Here's a small cygwin session dump:

-----------------------------------------------------------
Андрей Хропов@andrei-notebook /cygdrive/c/windows
$ ls -R | grep -i 'v3.0'
v3.0
./Microsoft.NET/Framework/v3.0:
./Microsoft.NET/Framework/v3.0/Microsoft .NET Framework 3.0:
./Microsoft.NET/Framework/v3.0/Microsoft .NET Framework 3.0 x86:
./Microsoft.NET/Framework/v3.0/Microsoft .NET Framework 3.0 x86/Logs:
./Microsoft.NET/Framework/v3.0/WPF:
./Microsoft.NET/Framework/v3.0/WPF/XamlViewer:
./Microsoft.NET/Framework/v3.0/WPF/en-us:
./Microsoft.NET/Framework/v3.0/Windows Communication Foundation:
./Microsoft.NET/Framework/v3.0/Windows Communication Foundation/MUI:
./Microsoft.NET/Framework/v3.0/Windows Communication Foundation/MUI/0409:
./Microsoft.NET/Framework/v3.0/Windows Workflow Foundation:
./Microsoft.NET/Framework/v3.0/Windows Workflow Foundation/SQL:
./Microsoft.NET/Framework/v3.0/Windows Workflow Foundation/SQL/EN:

Андрей Хропов@andrei-notebook /cygdrive/c/windows
$ ls -R | grep -i 'mscorlib'
mscorlib.dll
mscorlib.ldo
mscorlib.tlb
mscorlib.xml
mscorlib.dll
mscorlib.tlb
mscorlib.xml
sbscmp20_mscorlib.dll
mscorlib
./assembly/GAC_32/mscorlib:
./assembly/GAC_32/mscorlib/2.0.0.0__b77a5c561934e089:
mscorlib.dll
mscorlib
./assembly/NativeImages1_v1.1.4322/mscorlib:
./assembly/NativeImages1_v1.1.4322/mscorlib/1.0.5000.0__b77a5c561934e089_4c21e45
e:
mscorlib.dll
./assembly/NativeImages1_v1.1.4322/mscorlib/1.0.5000.0__b77a5c561934e089_fe458c2
9:
mscorlib.dll
mscorlib
./assembly/NativeImages_v2.0.50727_32/mscorlib:
./assembly/NativeImages_v2.0.50727_32/mscorlib/19a3b90fc7baec4392ccf1623b470388:

mscorlib.ni.dll
-----------------------------------------------------------


> That's why I ask if anybody have .NET 3.0
> installed, if so try to compile the example on it and then run.

I have it installed but as I have already demonstrated mscorlib remained the
same as in 2.0 and hence the generated assembly still fails to run.

-- 
AKhropov




More information about the devel-en mailing list