From: "Volkmann, Mark" Date: 2003-10-16T03:18:27+09:00 Subject: Re: Parentheses This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C39348.7FAE6AB2 Content-Type: text/plain; charset="iso-8859-1" I like Kirk's criteria for deciding when to use parens. The ability to omit them is one of the reasons I prefer Ruby syntax over Java syntax. The less noise, the better. > -----Original Message----- > From: Kirk Haines [mailto:khaines@enigo.com] > Sent: Wednesday, October 15, 2003 1:00 PM > To: ruby-talk@ruby-lang.org > Subject: Re: Parentheses > > > Bob Gustafson said: > > I prefer the parentheses. > > > > Parens are an 'ambiguity reducing notation' - without the > parens, you have > > to ask (from time to time) - "What is the precedence of > these operators in > > this language". > > > > Less ambiguity means clearer (human) code. > > I think that it depends. > > #1 > ----- > dbh.select_all sql do |row| > media_list.push QMedia.new *row > end > ----- > > #2 > ----- > dbh.select_all(sql) do |row| > media_list.push(QMedia.new(*row)) > end > ----- > > I think that #1 is easier to read than #2. However, consider: > > #3 > ----- > dbh.select_all sql,@client.idx do |row| > media_list.push QMedia.new me.idx,row[0],row[1] > end > ----- > > #4 > ----- > dbh.select_all(sql,@client.idx) do |row| > media_list.push QMedia.new(me.idx,row[0],row[1]) > end > ----- > > If there are multiple arguments, I prefer to use parens to > group them and > help make it clearer to my eyes where the groupings are. > > > Kirk Haines > > ------------------------------------------------------------------------------------------ A.G. Edwards & Sons' outgoing and incoming e-mails are electronically archived and subject to review and/or disclosure to someone other than the recipient. ------------------------------------------------------------------------------------------ ------_=_NextPart_001_01C39348.7FAE6AB2 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: Parentheses

I like Kirk's criteria for deciding when to use parens.&n= bsp; The ability to omit them is one of the reasons I prefer Ruby syntax ov= er Java syntax.  The less noise, the better.

> -----Original Message-----
> From: Kirk Haines [mailto:khaines@enigo.com]
> Sent: Wednesday, October 15, 2003 1:00 PM
> To: ruby-talk@ruby-lang.org
> Subject: Re: Parentheses
>
>
> Bob Gustafson said:
> > I prefer the parentheses.
> >
> > Parens are an 'ambiguity reducing notation' - = without the
> parens, you have
> > to ask (from time to time) - "What is the= precedence of
> these operators in
> > this language".
> >
> > Less ambiguity means clearer (human) code.
>
> I think that it depends.
>
> #1
> -----
> dbh.select_all sql do |row|
>   media_list.push QMedia.new *row
> end
> -----
>
> #2
> -----
> dbh.select_all(sql) do |row|
>   media_list.push(QMedia.new(*row))
> end
> -----
>
> I think that #1 is easier to read than #2.  Ho= wever, consider:
>
> #3
> -----
> dbh.select_all sql,@client.idx do |row|
>   media_list.push QMedia.new me.idx,row[0= ],row[1]
> end
> -----
>
> #4
> -----
> dbh.select_all(sql,@client.idx) do |row|
>   media_list.push QMedia.new(me.idx,row[0= ],row[1])
> end
> -----
>
> If there are multiple arguments, I prefer to use pa= rens to
> group them and
> help make it clearer to my eyes where the groupings= are.
>
>
> Kirk Haines
>
>



---------------------------------------------------------------------------= ---------------
A.G. Edwards & Sons' outgoing and incoming e-mails are electronically
archived and subject to review and/or disclosure to someone other
than the recipient.

---------------------------------------------------------------------------= ---------------
------_=_NextPart_001_01C39348.7FAE6AB2--