Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 471E49C8E for ; Mon, 28 May 2012 15:28:22 +0000 (UTC) Received: (qmail 33241 invoked by uid 500); 28 May 2012 15:28:22 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 32961 invoked by uid 500); 28 May 2012 15:28:21 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 32952 invoked by uid 99); 28 May 2012 15:28:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 15:28:21 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 209.85.214.171 as permitted sender) Received: from [209.85.214.171] (HELO mail-ob0-f171.google.com) (209.85.214.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 May 2012 15:28:12 +0000 Received: by obfk16 with SMTP id k16so7649372obf.30 for ; Mon, 28 May 2012 08:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=QqVKgJyAkIg78vYV+6pgXc1NZXwoz+xpG//qaD8fWJs=; b=QB1hNOnAPKiJOi+e1O1e5jW4RS3KRoE8NQbXH0EleObkCWxRhfT5+2XaolaBsu45Zv p94oazf0S8vkJQtF8XB4meFC/zR0wKL2gniX5JoBvBE5OccJ/OYtmJ9VTTDT+6cTxvt+ m9ut2pfg0e3ra6/sq3v7FijQER6J88FwBMWA8Qi5QmYBwjRuyqjV66/WzD9R/qODbWJM iElAFDPZesDa6p9oioip/oxkod2UfENDTYtOhk4nmxvwMk3Cvry9+E43l4B3fRYwSB7x Sv9vluvt64E7TNvufDd9jVnpFo0tgxFZ/v1sySvlKonZ+h6bWgtwlZ2rkio0hTHnPxMg v2Ig== MIME-Version: 1.0 Received: by 10.182.117.39 with SMTP id kb7mr8111499obb.37.1338218872181; Mon, 28 May 2012 08:27:52 -0700 (PDT) Received: by 10.182.105.70 with HTTP; Mon, 28 May 2012 08:27:52 -0700 (PDT) In-Reply-To: References: <20120528083114.43AF123888FE@eris.apache.org> <20120528101256.GI10938@dusk.harfang.homelinux.org> <20120528121707.GL10938@dusk.harfang.homelinux.org> Date: Mon, 28 May 2012 16:27:52 +0100 Message-ID: Subject: Re: svn commit: r1343163 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/linear/ test/java/org/apache/commons/math3/linear/ From: sebb To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On 28 May 2012 13:28, S=E9bastien Brisard wrote= : > Hi Gilles, > > 2012/5/28 Gilles Sadowski : >> Hello. >> >>> >>> > >>> > Why do you call "valueOf"? >>> > >>> I have to say I do not like implicit conversions, that's why I tend to >>> always use Integer.valueOf and the likes. >> >> Why? >> > This is going to get "philosophical": I would not dare to claim that > I'm holding *the* truth, this is only my way of seeing things. I do > not like things to happen implicitely, because I think that it opens a > door to errors (this would not be true of professional programmers, > but remember that I work in an environment where people are not real > computer scientists... so my philosophy is "close as many doors as you > can"...). I even think that J. Bloch has a nice example of potential > issues with auto-boxing. However, I agree with you: calling valueOf in > this context (that is: building a new exception) is certainly > far-fetched. > > That was the initial reason why I moved from C++ to Java ten years > ago: too many things happened "behind my back". Again, I'm not saying > that C++ is evil. I'm just saying that I did not have the background > with C++ to be fully aware of these implicit assumptions, and their > potential consequences. > > I'm pretty sure I will not convince you on this. I hope I have at > least convinced you that I have a good reason to do it this way :-) > I agree with you - making boxing explicit is better. The reasoning is that implicit boxing/unboxing can hide ineffiicient conversions as well as subtle bugs. I've seen code which treats the same item variously as a Integer and an int for no good reason. The compiler warnings allow the careful programmer to investigate and choose one or the other. Yes, the code is a bit longer, but it clearly shows that the boxing/unboxing was intended, and not an accident of compiler "helpfulness". >>> However, if you think that >>> it leads to less readable code, I'm OK with your way of seeing things. >> >> Good! ;-) >> >> Gilles >> > As I said, I will remove these explicit boxings (but be warned: I've > used valueOf() in the past, and do apologize for any unwanted > occurence...). > > Best regards, > S=E9bastien > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org