From: Peter C. Chapin on
anon(a)anon.org wrote:

> These two packages and their sub-packages should of been introduced
> to Ada's RM a back in 2000 or earlier but the powers that be
> preferred unions and "oops" and now conditional structures instead.
> None of which truly aid Ada. These ideas are slowly causes the
> death of Ada because without graphics and windows routine Ada is
> limited in it scope of partitions that people want.

My understanding is that Ada is primarily a "systems" programming language. It
supports embedded programming, real time programming, and other "low level"
applications. People writing such programs are not particularly concerned
about GUI packages. Well... I can't speak for everyone, but I'm using Ada in
an embedded application and I'm certainly not worried about the lack of GUI
support.

Of course some people do want GUI support and, in fact, there are Ada
libraries that do that now. If you feel they are inadequate, you could
perhaps create something better. The question isn't about the value of GUI
packages (I'm sure we all agree such packages have value) but rather the
value of putting such support into the language standard.

> Now, with the release of GNAT 2009, Adacore started including
> "Conditional Structures".
>
> In GNAT 2009, the "If" conditional structure was added.
>
> <Variable> := (if ... then ... else ... );
>
> Not sure if you can use add the "elsif .... then" clause.
>
> This is too close to C like structures for any Ada purist to approve of.

I wasn't involved in the discussion that lead to the decision to include
conditional expressions in Ada, but my impression is that they were
introduced in large measure to make the new pre- and post-conditions more
expressive. When writing a post-condition on a subprogram you only get a
single expression... not a statement (please correct me if I'm wrong). Thus
if you want to write something complicated conditional expressions and case
expressions become useful. Once you've added such expressions to the language
there is little point is prohibiting them from "normal" code sequences.

In any case conditional expressions are entirely normal in functional
languages and widely implemented by such languages. They are not some sort of
C quirk as you seem to suggest. I'm not suggesting that Ada should become a
functional language (lambdas, anyone?) but to a person fluent with functional
programming such expressions are very natural.

Peter

From: Adam Beneschan on
On Jun 23, 12:57 pm, "Peter C. Chapin" <pcc482...(a)gmail.com> wrote:

> > Now, with the release of GNAT 2009, Adacore started including
> > "Conditional Structures".
>
> > In GNAT 2009, the "If" conditional structure was added.
>
> >    <Variable> := (if ...  then ... else ... );
>
> > Not sure if you can use add the "elsif .... then"  clause.
>
> > This is too close to C like structures for any Ada purist to approve of..
>
> I wasn't involved in the discussion that lead to the decision to include
> conditional expressions in Ada, but my impression is that they were
> introduced in large measure to make the new pre- and post-conditions more
> expressive.

I don't think conditional expressions are officially part of Ada yet.
The changes haven't been approved. So if some compiler accepts them,
it's a compiler for some other language that isn't Ada.

-- Adam
From: Robert A Duff on
Adam Beneschan <adam(a)irvine.com> writes:

> I don't think conditional expressions are officially part of Ada yet.
> The changes haven't been approved. So if some compiler accepts them,
> it's a compiler for some other language that isn't Ada.

That's right. They are proposed for Ada 2012. GNAT accepts them
under the -gnat2012 switch. AdaCore will probably be adding more
Ada 2012 features in the future.

If you choose to use Ada 2012 features before the Ada 2012 is
standardized, then you are not using Ada, and you run the
risk that things might change.

- Bob
From: Robert A Duff on
"Peter C. Chapin" <pcc482719(a)gmail.com> writes:

> I wasn't involved in the discussion that lead to the decision to include
> conditional expressions in Ada, but my impression is that they were
> introduced in large measure to make the new pre- and post-conditions more
> expressive.

Yes, that's a big part of the reason. One use for them is to express
logical implication. ARG considered, and rejected, the idea of
adding an "implies" operator. Instead, you can say something like:

procedure P (...) with
Pre => (if X > 10 then Y > 10);

The "else True" is implied here. So it means the same
as what "X > 10 implies Y > 10" would mean if "implies"
were in the language.

This is not (yet) Ada! It is proposed for Ada 2012.

> In any case conditional expressions are entirely normal in functional
> languages and widely implemented by such languages. They are not some sort of
> C quirk as you seem to suggest. I'm not suggesting that Ada should become a
> functional language (lambdas, anyone?) but to a person fluent with functional
> programming such expressions are very natural.

Lambdas should indeed be added to Ada, IMHO, and they have been
discussed by ARG. I forget the status, but I don't think they'll
make it in. We had a lot of trouble coming up with a readable
syntax, for one thing. (And nobody proposed any syntax involving
a "lambda" keyword.)

But to be a true functional language Ada would need more than that.
Full closures, for example. And those pretty much require
garbage collection.

- Bob
From: Brian Drummond on
On Wed, 23 Jun 2010 19:19:42 +0100, "(see below)" <yaldnif.w(a)blueyonder.co.uk>
wrote:

>On 23/06/2010 17:20, in article hvtc8u$rpp$1(a)speranza.aioe.org,
>"anon(a)anon.org" <anon(a)anon.org> wrote:
>
>
>> Unions are one thing, but non Ada conditional structures are another!
>>
>> AT&T create C and the first C compiler then ...
>> Also, even a logical statement may result in a true value for one
>> system while being false in another. So, to solve some of these
>> and others problems conditional structures were added to C instead
>> of defining and enforcing a C RM.
>
>This is nonsense C history and nonsense Ada language genealogy.
>Conditional expressions originated in Ada's direct ancestor, Algol.
>I'm delighted to see their reappearance in Ada.

Having cut my teeth on Algol-W, so am I.

If-expressions and case-expressions in Algol-W seemed natural to me, and gave
very readable code.

(Though I never felt comfortable with the C syntax. Given the usual C values for
true and false, it feels too much like an arithmetic-if, but with the list of
choices, confusingly, in descending order!)

And Ada is not alone in modern languages; they are also coming back in
sequential code in VHDL-2008 (with different syntax, alas).
VHDL has always had them among its concurrent statements.

- Brian