Re: [IronPython] Array Access Problem

2005-05-26 Thread Bob Ippolito
On May 10, 2005, at 10:57 AM, Jim Hugunin wrote: Bob Ippolito wrote: (1) Don't have mutable value types, use a reference type that points to a value type (some kind of proxy) I don't think that this is possible to do in a consistent way and my suspicion is that doing this half-way would be

Re: [IronPython] Array Access Problem

2005-05-25 Thread Timothy Fitz
On 5/10/05, Jim Hugunin <[EMAIL PROTECTED]> wrote: > >>> apt[0] = pt > What do we do here? We need to copy the data in pt into apt[0]. This > is what it means to have an array of structs. No matter what we do with > proxies or wrappers there's no way out of this copy. We could add some > kind o

RE: [IronPython] Array Access Problem

2005-05-11 Thread Keith J. Farmer
I guess not.. lock protects reference types From: [EMAIL PROTECTED] on behalf of Keith J. Farmer Sent: Wed 5/11/2005 3:54 PM To: Discussion of IronPython Subject: RE: [IronPython] Array Access Problem In the case of multi-threaded use, shouldn't valu

RE: [IronPython] Array Access Problem

2005-05-11 Thread Keith J. Farmer
: Wed 5/11/2005 2:34 PM To: Discussion of IronPython Subject: RE: [IronPython] Array Access Problem > If so, what if another thread is concurrently modifying a different > member of the underlying struct? This is a good point. In that case there is a potential difference between my tw

RE: [IronPython] Array Access Problem

2005-05-11 Thread Jim Hugunin
Drew Moore wrote: > Jim Hugunin wrote: > > > >Because of the way that value types work, there's no difference between > >the results of > > apt[0].X = 0and apt[0] = Point(0, apt[0].Y) > > > >The big question is how important it is that both of the following are > >equivalent. > > apt[0].X =

Re: [IronPython] Array Access Problem

2005-05-11 Thread Drew Moore
Jim Hugunin wrote: Because of the way that value types work, there's no difference between the results of apt[0].X = 0and apt[0] = Point(0, apt[0].Y) The big question is how important it is that both of the following are equivalent. apt[0].X = 0andtmp = apt[0]; tmp.X = 0 Just cur

RE: [IronPython] Array Access Problem

2005-05-10 Thread Jim Hugunin
Timothy Fitz wrote: > On 5/10/05, Jim Hugunin <[EMAIL PROTECTED]> wrote: > > >>> apt[0].X = 0 > > If value types were immutable this would throw. The exception message > > might give people enough information to get started tracking down the > > issue and modifying their code to work correctly. >

Re: [IronPython] Array Access Problem

2005-05-10 Thread Timothy Fitz
On 5/10/05, Jim Hugunin <[EMAIL PROTECTED]> wrote: > >>> apt[0].X = 0 > If value types were immutable this would throw. The exception message > might give people enough information to get started tracking down the > issue and modifying their code to work correctly. I want to say this should be eq

RE: [IronPython] Array Access Problem

2005-05-10 Thread Jim Hugunin
I think that value types are a real advantage of the Common Language Infrastructure (CLI) even though they make life more difficult for IronPython. They're an advantage because they're an essential concept for a number of data structures and people will use the notion of a value type whether or no

Re: [IronPython] Array Access Problem

2005-05-07 Thread Drew Moore
Bob Ippolito wrote: There are ways you *could* fix the issue: (1) Don't have mutable value types, use a reference type that points to a value type (some kind of proxy) (2) Make value types immutable (or at least the ones you grab from collections) I kinda like both of these options. Darn dual pa

Re: [IronPython] Array Access Problem

2005-05-06 Thread Drew Moore
Jim Hugunin wrote: This is a known problem, but we don't have a good fix to it in IronPython. Here's how to set just the X value of a Point in an array today: apt[0] = Point(0, apt[0].Y) OR p = apt[0] p.X = 42 apt[0] = p It is a known problem in other .NET languages, correct? Not just Python?

Re: [IronPython] Array Access Problem

2005-05-05 Thread Bob Ippolito
On May 5, 2005, at 3:02 PM, Sriram Krishnan wrote: However, any time that I think about changing an invariant of the Python language I get rather nervous about the ramifications... One ramification that I can instantly think of is looping over an array of valuetypes. On more than one occasion,

RE: [IronPython] Array Access Problem

2005-05-05 Thread Sriram Krishnan
>However, any time that I think about changing an invariant of the Python language I get rather nervous about the > ramifications... One ramification that I can instantly think of is looping over an array of valuetypes. On more than one occasion, doing a foreach over an array of structs in C# ha

RE: [IronPython] Array Access Problem

2005-05-05 Thread Jim Hugunin
: Thursday, May 05, 2005 9:56 AM To: users-ironpython.com@lists.ironpython.com Subject: [IronPython] Array Access Problem I can't seem to change the members of an array. Is this a known problem?   import sys   sys.LoadAssemblyByName("System") sys.LoadAssemblyByName("System.Dra

[IronPython] Array Access Problem

2005-05-05 Thread Kirk Olynyk
I can’t seem to change the members of an array. Is this a known problem?   import sys   sys.LoadAssemblyByName("System") sys.LoadAssemblyByName("System.Drawing")   from System import* from System.Drawing import *   apt = Array.CreateInstance(Point, 1) apt[0] = Point(1,2) print a