[J3] Question about the conditional expression syntax in 21-157r2

Malcolm Cohen malcolm at nag-j.co.jp
Wed Jun 30 20:53:37 UTC 2021


Hi Milan,

 

Well, using ordinary parens instead of special parens was what I objected to.

 

But without any delimiter, there is ambiguity and a greatly increased risk of error.

 

So IMO,

   special parens = best

   ordinary parens = acceptable

   no parens = unacceptable

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Milan Curcic via J3
Sent: Thursday, July 1, 2021 2:54 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Milan Curcic <caomaco at gmail.com>
Subject: [J3] Question about the conditional expression syntax in 21-157r2

 

Hi Malcolm,

 

In 21-157r2, you wrote:

 

> Conditional expression with elseif-chaining:
>     ( cond ? expr : cond2 ? expr2 : expr3 )

 

Are parens required? It seems to me that they don't need to be and we could write:

 

Conditional expression with elseif-chaining:

     cond ? expr : cond2 ? expr2 : expr3

 

and if a programmer likes parens as a visual, they can add them.

 

What do you think?

 

Thanks,

Milan

 

Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: 30 St. Giles, Oxford, OX1 3LE, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice>  for information on how we process personal data and for details of how to stop or limit communications from us.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210701/017018e1/attachment.htm>


More information about the J3 mailing list