From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,334f9012742e58fc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Gnat GPL 2010 available soon (conditional expressions) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <2010061621145016807-sjs@essexacuk> <0fa4c574-9539-492f-8514-d32c68beb22a@w31g2000yqb.googlegroups.com> <1frrgtpa5dycl$.12kl72iqsg3dx$.dlg@40tude.net> <4c270613$0$6974$9b4e6d93@newsspool4.arcor-online.net> Date: Sun, 27 Jun 2010 10:37:53 +0200 Message-ID: <1wuwvzgwlwgli$.1birkinieia0d$.dlg@40tude.net> NNTP-Posting-Date: 27 Jun 2010 10:37:52 CEST NNTP-Posting-Host: dcfd4ee0.newsspool3.arcor-online.net X-Trace: DXC=HSX3Pe>c[Q3^8FBo0_81f>McF=Q^Z^V384Fo<]lROoR18kF[ On Sun, 27 Jun 2010 10:04:35 +0200, Georg Bauhaus wrote: > On 6/26/10 11:42 PM, Dmitry A. Kazakov wrote: >> On Sat, 26 Jun 2010 05:04:10 -0700 (PDT), lekktu@gmail.com wrote: >> >>> Well, it hasn't been hard to find the first bug. >>> >>> -------------------------------------------------------------------------------- >>> function Validate (Dir : in String) return String is >>> begin >>> return (if Dir (Dir'Last) = '\' then Dir else Dir& '\'); >>> end Validate; >>> -------------------------------------------------------------------------------- >> >> [...] >>> I'll submit a bug report. >> >> (Yes, to remove that abomination from the language! (:-)) >> >> I didn't read the AI, but your code looks very strange to me. Isn't its >> syntax exposed to the infamous Pascal-if flaw? I mean, where is the "end >> if"? Is this legal: >> >> (if A then X else if B then Y else Z) > > As the AI explains, you will need bracketing. Once I designed a language like that. It was out of necessity because that specialized language had only expressions. I also used brackets, but dropped "if", because you don't need it: (A then B [else C]) is syntactically unambiguous and easier to read. Anyway I do hate the idea, partially because I have been using that language for a long time. > Conditional expressions are supposed to remove the need for some single > purpose functions, see the example in the AI lekktu has mentioned. Single-purpose functions do not exist, likewise single-purpose types etc. Thinking of something in this way will give you a design/maintenance problem later. Ada was never designed to minimize up front thinking and typing in mind. > Unlike the return object of a function, the value of a > conditional expression cannot be renamed. A special purpose > function in place of a conditional expression has to have a > return object. We can't rely on effective inlining or on > evaluation at compile time, either. can you rely on what the compiler does for if-expressions? Come on, that is a silly argument. If inlining is a problem add pragma Enforced_Inline. > OTOH, we get the anonymity of conditional expressions, and > an opportunity to deviate from Ada's principle of linear reading. towards the principle of no reading? Write and rewrite, but never read what you wrote... > Consequently, conditional expressions will make Ada > more attractive for programmers who still know the joys of > clever programming constructs like syntactical inversion > of control structure. Sorry, if I misunderstood you. Do you seriously mean that the goal of language design is attracting some people? > If their modes of expression are not wanted on some project, > the project can use additional source code analysis tools. > These will complain when noticing nested conditional expressions, > for example. In C projects you can use lint. Does it make the design of C any better? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de