Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 69330 invoked from network); 12 Apr 2005 23:18:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Apr 2005 23:18:02 -0000 Received: (qmail 45771 invoked by uid 500); 12 Apr 2005 23:17:59 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 45735 invoked by uid 500); 12 Apr 2005 23:17:59 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 45722 invoked by uid 99); 12 Apr 2005 23:17:59 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from vpn1.seagullsw.com (HELO mailer18.seagullsoftware.com) (12.6.96.5) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 12 Apr 2005 16:17:58 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [lang] return statements [was VOTE 2.1 release] Date: Tue, 12 Apr 2005 19:17:55 -0400 Message-ID: <2B64219028BBFF48B3CC957EF10B58FE726899@ns1018.SSSI.seagull.nl> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [lang] return statements [was VOTE 2.1 release] Thread-Index: AcU/r/rFSGh06Hr6TfucSpPVLimKbgAAnisgAADJXDA= From: "Gary Gregory" To: "Jakarta Commons Developers List" X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Tell you what, let me wait to commit 'til tomorrow in case more folks want to weigh in on Stephen's side and we feel this needs more discussion. This is a minor issue, but what the hay, there no rush ;-) Gary -----Original Message----- From: Gary Gregory [mailto:ggregory@seagullsoftware.com]=20 Sent: Tuesday, April 12, 2005 4:05 PM To: Jakarta Commons Developers List Subject: RE: [lang] return statements [was VOTE 2.1 release] Hello: WRT "Sorry, see [collections] DEVELOPERS-GUIDE." Should we create one for [lang]? IMHO, it seems that we can delegate to the commons code style (Sun + tweaks), unless we think that we should explicitly guide away from "return (expression);" I would prefer having a consistent "return expression" in [lang] and not have a dev-guide note for this. WRT "The example should probably be a Boolean" Indeed, this mistake surely comes from the initial Sun "let's make it easy for C/C++ developers to learn Java" POV. I'll have to agree to disagree with Stephen on the "return (expression)" biz.=20 Since we've had an informal "-1 to return (foo) :)" from Henri, I'll commit. Gary -----Original Message----- From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]=20 Sent: Tuesday, April 12, 2005 3:36 PM To: Jakarta Commons Developers List Subject: Re: [lang] return statements [was VOTE 2.1 release] Gary Gregory wrote: > WRT "Better put it in the lang guidelines though." Sorry, see [collections] DEVELOPERS-GUIDE. > On Sun's doc, in the section "7.3 return statements" [4], quote: > A return statement with a value should not use parentheses unless they > make the return value more obvious in some way. Example: >=20 > return; >=20 > return myDisk.size(); >=20 > return (size ? size : defaultSize); The example should probably be a boolean, eg: return (isBig() ? size : defaultSize); return isBig() ? size : defaultSize; and, yes, the former is a lot clearer to my eyes (with the brackets). (For me, the brackets give a mental indication that you must scan the=20 whole line to understand it, emphasising that it is a single expression. Whereas without the brackets, my mind must deduce that it is an=20 expression from the return statement, which is more effort) Stephen --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org