My guess is MS are going to do exactly what you did, create a new namespace for collections that support templates.
As for your ambiguous reference issue, I read though the C# Template doc this weekend, and I gotta tell you, I'm not 100% on this. The doc was a tad bit tough to follow (I'm sure a second reading will clear things up for me), but I think the compiler is doing what its supposed to. Both of these objects are Stack objects, I don't think the addition of a generic is enough to stop the namespace collision. I went back and explicitly qualified the stack references (as I'm sure you did) and it compiled just fine. Anyway, just wanted to weigh in on this... It's still pretty early on a Monday so I'll use that as an excuse if I'm wrong =) Don > -----Original Message----- > From: Keith Hill [mailto:[EMAIL PROTECTED]] > Sent: Sunday, September 08, 2002 3:09 AM > To: [EMAIL PROTECTED] > Subject: [DOTNET-ROTOR] Disambiguating parameterized and > non-parameterized class names > > > I have been wondering how Microsoft might add generics to the > MS .NET Framework (hopefully by 2.0). And I was wondering > how they would maintain source code compatibility with > something like ArrayList while adding ArrayList<T>. I tried > a simple experiment with a brain dead stack class (both > parameterized and not) and I get the following error with the > Gyro- ized Rotor csc compiler: > > error CS0104: 'Stack' is an ambiguous reference > > The code is listed below. It seems odd that the compiler > would find a > reference to Stack as ambiguous (can't tell if I want Stack > or Stack<int>). Should this work and the compiler just > doesn't handle it correctly yet or not? > > Here is the code: > > namespace Collections { > public class Stack { > private object[] m_stack; > private int m_ndx = 0; > private const int s_size = 50; > > public Stack() { > m_stack = new object[s_size]; > } > > public void Push(object obj) { > if (m_ndx >= (s_size - 1)) { > throw new System.Exception("Stack overflow"); > } > m_stack[m_ndx++] = obj; > } > > public object Pop() { > if (m_ndx == 0) throw new System.Exception("Stack > underflow"); > return m_stack[--m_ndx]; > } > } > } > > namespace TemplatedCollections { > public class Stack<T> { > private T[] m_stack; > private int m_ndx = 0; > private const int s_size = 50; > > public Stack() { > m_stack = new T[s_size]; > } > > public void Push(T item) { > if (m_ndx >= (s_size - 1)) { > throw new System.Exception("Stack overflow"); > } > m_stack[m_ndx++] = item; > } > > public T Pop() { > if (m_ndx == 0) throw new System.Exception("Stack > underflow"); > return m_stack[--m_ndx]; > } > } > } > > namespace Acme { > using System; > using Collections; > using TemplatedCollections; > > class App { > public static void Main() { > Stack s1 = new Stack(); // CSC error here > s1.Push(1); > s1.Push(4); > s1.Push((int)s1.Pop() + (int)s1.Pop()); > Console.WriteLine(s1.Pop()); > > Stack<int> s2 = new Stack<int>(); > s2.Push(1); > s2.Push(4); > s2.Push(s2.Pop() + s2.Pop()); > Console.WriteLine(s2.Pop()); > } > } > } >