Johann MacDonagh wrote: > On 12/27/07, Bruce Markham <[EMAIL PROTECTED]> wrote: > >> I know my brain is frazzled, which it is most nights at 3am, even when I >> haven't been reading PCI specifications all day. >> >> But I do know, that if compile Assembly A with Generic Type 1. And Assembly >> B with Normal Type 2 that uses Generic Type 1, it won't be able to >> re-compile its own version of Generic Type 1 because Generic Type 1 will be >> machine language on the disk. >> >> And unless you want all programs to take up twice as much HDD because you >> want to have both IL and machine language sitting around, it doesn't scale >> well. (Especially if you have embedded resources.) >> > > So, > > Assembly 1: > public class SomeType > { > public int i; > } > > Assembly 2: > public class SomeType2<SomeType> > { > } > > What you're saying is that after Assembly 1 was AOTed, and then > Assembly 2 was AOTed, it would be impossible to change the class > SomeType without having to re-AOT Assembly 2? > > I think it's possible. When we AOT SomeType2, we shouldn't statically > embed information about SomeType into it at all. Simple a pointer. > > But I suppose this brings up a lot of issues. Let's say we have this: > > Assembly 1: > public class Type1 > { > int i = 5; > } > > Assembly 2 > public class Program > { > public static int Main(string[] args) > { > Type1 a = new Type1(); > a.i = 100; > } > } > > and we AOT both of them. Now, if we change the definition of Type1, > let's say we get rid of the field i and replace it with a field j, > then Assembly 2 would have to be able to throw a runtime exception. If > we can do that, then I don't think there's any problem with AOTing > generic types. > > Johann > > Yes, essentially (once compiled):
public class MyGenericClass { void * value; Type t; public void * DoSomething() { value = Activator.CreateInstance(t); return value; } } And in the class using it: public static void Main { MyGenericClass c = new MyGenericClass(); c.t = typeof(FooClass); // AOT inserts this. FooClass a = (FooClass) c.DoSomething(); // AOT inserts cast. } -- Jonathan Dickinson ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ SharpOS-Developers mailing list SharpOS-Developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sharpos-developers