1

Closed

Immutable Data Structures constructors

description

Importan bug in all the Immutable Data Structures, the constructor is not private
Closed Nov 30, 2009 at 3:22 PM by

comments

Olmo wrote Nov 30, 2009 at 3:22 PM

Upsy.... It's fixed now. Will be up for the next version

Olmo wrote Nov 30, 2009 at 3:33 PM

Mmmm, really is not a bug. The only public constructor belongs to the private neasted classes inside the Immutable Data Structures. So the constructor is public only to the parent class, but not to the client code :)
public class ImmutableStack:IEnumerable
{
    private class ImmutableFullStack : ImmutableStack
    {
        readonly T head;
        readonly ImmutableStack tail;

        public ImmutableFullStack(T head, ImmutableStack tail)
        {
            this.head = head;
            this.tail = tail;
        }

     [...]
  }
 [...]
}