[J3] Question about the conditional expression syntax in 21-157r2
Van Snyder
van.snyder at sbcglobal.net
Thu Jul 1 00:07:51 UTC 2021
On Thu, 2021-07-01 at 05:53 +0900, Malcolm Cohen via J3 wrote:
> 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.
I'm traveling, so I knew I couldn't participate in this meeting, so I
haven't studied the proposals. So the answers might be obvious.
Are parentheses required to avoid ambiguity if a conditional expression
is the entirety of an expression, such as1. An actual argument?2. The
RHS of an assignment statement?3. The <expr> in a IF statement?4. Can a
conditional form produce a variable, or only a value? Especially as an
actual argument?
>
> 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 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/20210630/35fdc7bd/attachment.htm>
More information about the J3
mailing list