[Edu-sig] Properties use case

Chuck Allison chuck at freshsources.com
Sat Mar 18 22:23:46 CET 2006


Hello Scott,

In C++ we have a saying for value types, such as complex numbers: "Do
as the ints do". The complex class in C++ is also immutable. I have
never seen a need for mutable numeric, scalar quantities since I
began scientific programming 30 years ago. Just a perspective.

Friday, March 17, 2006, 5:23:08 PM, you wrote:

SDD> ajsiegel at optonline.net wrote:

>> Instead of having my geometric objects of the complex plane *be* complex numbes, 
>> there is certainly the solution of having a complex number as an attribute of these objects - 
>> and then I can take more your approach, and at the speed of C, since I would then 
>> be using the built-in for arithmettic operations.
>> 
>> There remained something unsatisfying to me about that approach.  
>> 
>> Until something blows up about my current approach, I am quite happy with it. 

SDD> The thing that typically blows up is when you are (for example)
SDD> computing with a complex number that is changed halfway through
SDD> the computation by another thread (say a mouse drag).  The square
SDD> root winds up being neither the square root of the original number
SDD> nor of the new changed number.  Further, it becomes dicey to
SDD> try to prove that your square root function will always terminate
SDD> (a step size from one that is guaranteed to settle might be a
SDD> disaster at the new-improved value.

SDD> So, that's why CS people like immutable primitive types.

SDD> -- Scott David Daniels
SDD> Scott.Daniels at Acm.Org

SDD> _______________________________________________
SDD> Edu-sig mailing list
SDD> Edu-sig at python.org
SDD> http://mail.python.org/mailman/listinfo/edu-sig




-- 
Best regards,
 Chuck




More information about the Edu-sig mailing list