Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: supercalifragilisticexpialadiamaticonormalizeringelimatisticantations Newsgroups: comp.lang.java.programmer Subject: Re: Arithmetic overflow checking Date: Mon, 25 Jul 2011 13:29:56 -0400 Organization: supercalifragilisticexpialadiamaticonormalizeringelimatisticantations Lines: 21 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <4e278a67$0$309$14726298@news.sunsite.dk> <1SSVp.69032$_I7.18660@newsfe08.iad> <4b8422e6-9ad6-493e-b5a5-3c8a772851de@u6g2000prc.googlegroups.com> NNTP-Posting-Host: cJ+uP0NdDAbt8UCZbZVtiQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: WinVN 0.99.12z (x86 32bit) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6541 On 25/07/2011 1:20 PM, Joshua Cranmer wrote: > On 7/23/2011 7:39 PM, > supercalifragilisticexpialadiamaticonormalizeringelimatisticantations > wrote: >> Wrong. >> >> Ordinary ints aren't (in Java, at least, with no "int *" type) subject >> to aliasing and other problems that a mutable Integer-analogue would be. > > Then I suppose you'd have no objection to making the Matrix class > immutable and implicitly copying itself every time you do an operation. > I really appreciate that when using Householders to find eigenvalues in > my small 10Kx10K matrix. We were talking about numbers, not matrices. For something like matrices, I'd consider it "good enough" to have a mutable and an immutable version, with mutable ones used inside of methods as temporaries and the immutable type used in argument and return types. (Obviously each would have a constructor that accepted the other type.)