[IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Chris Anderson (WINDOWS)
Title: IronPython.Objects.List doesn't support GetHashCode() Is there any special reason why this is the case? The code currently reads:     public override int GetHashCode() {     throw Ops.TypeError("list object is unhashable");     } So it’s obviously intentional… howev

RE: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Jim Hugunin
SyncRoot should be supported on lists. This wasn't done only due to laziness on my part. GetHashCode is less clear. The property of GetHashCode that you're missing is that it must be consistent with Equals. This is required by both Python and the CLI. It's not possible to implement Python's

Re: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Chris Anderson
The problem with this model is that it requires you to subclass and use a special type. My goal is to enable simple usage in binding scenarios:   _list.ItemsSource = range(5)   This means that every list/dictionary/touple needs to support ICustomTypeDescriptor and GetHashCode/SyncRoot... The ICD r

Re: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Timothy Fitz
On 5/12/05, Chris Anderson <[EMAIL PROTECTED]> wrote: > I believe that simply returning "1" from GetHashCode() would work just fine > - however it would mean that hashtables would effectively become linked > lists or linear arrays (depending on their implementation). From that model, > returning th

Re: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Chris Anderson
I'll be the first to admit that I'm not the master of language design or hashtables...   My understanding was that the hash of an object needed to be consistent over the life of the object (therefore providing a way for a hashtable to find the bucket for it) and relatively unique (basically, that

Re: [IronPython] IronPython.Objects.List doesn't support GetHashCode()

2005-05-12 Thread Timothy Fitz
On 5/12/05, Chris Anderson <[EMAIL PROTECTED]> wrote: > Is there any special reason why this is the case? The code currently reads: > >public override int GetHashCode() { >throw Ops.TypeError("list object is unhashable"); >} > > So it's obviously intentional… however,