comp.lang.ada
 help / color / mirror / Atom feed
* Re: new language construct proposed
  1998-01-23  0:00 new language construct proposed Chris Sparks (Mr. Ada)
@ 1998-01-23  0:00 ` Nick Roberts
  1998-01-26  0:00 ` Anonymous
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Roberts @ 1998-01-23  0:00 UTC (permalink / raw)



I guess it will be Ada 2007?

-- 

Nick Roberts
Croydon, UK

Proprietor, ThoughtWing Software; Independent Software Development
Consultant
* Nick.Roberts@dial.pipex.com * Voicemail & Fax +44 181-405 1124 *
*** Always game for a verbal joust (usually as the turkey) ***


Chris Sparks (Mr. Ada) <mrada@CATALINA-INTER.NET> wrote in article
<34C8E253.7E9F@catalina-inter.net>...
> Hi all,
> 
> I sure wish that the following was implemented in the language:
> 
> raise <EXCEPTION> when <CONDITIONAL_EXPRESSION>;
> 
> oh well....





^ permalink raw reply	[flat|nested] 9+ messages in thread

* new language construct proposed
@ 1998-01-23  0:00 Chris Sparks (Mr. Ada)
  1998-01-23  0:00 ` Nick Roberts
  1998-01-26  0:00 ` Anonymous
  0 siblings, 2 replies; 9+ messages in thread
From: Chris Sparks (Mr. Ada) @ 1998-01-23  0:00 UTC (permalink / raw)



Hi all,

I sure wish that the following was implemented in the language:

raise <EXCEPTION> when <CONDITIONAL_EXPRESSION>;

oh well....


Chris Sparks




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-01-23  0:00 new language construct proposed Chris Sparks (Mr. Ada)
  1998-01-23  0:00 ` Nick Roberts
@ 1998-01-26  0:00 ` Anonymous
  1998-01-30  0:00   ` Ray Blaak
  1998-02-01  0:00   ` Robert Dewar
  1 sibling, 2 replies; 9+ messages in thread
From: Anonymous @ 1998-01-26  0:00 UTC (permalink / raw)



On Fri, 23 Jan 1998 10:32:51 -0800, "Chris Sparks (Mr. Ada)"
<mrada@CATALINA-INTER.NET> wrote:

> Hi all,
> 
> I sure wish that the following was implemented in the language:
> 
> raise <EXCEPTION> when <CONDITIONAL_EXPRESSION>;
> 
> oh well....
> 
> 
> Chris Sparks
> 
> 

I submitted a revision request for this:

raise [exception_name] [when boolean_expression];

thinking it would be clear, easy to implement, not cause any problem
with existing Ada-83 code, and be useful. It didn't make it into the
revised language.

Note that the exception name is optional so you can use it in an
exception handler.

A "when" clause on the return statement would also be clear, useful,
easy to implement, and not cause any problem with existing code. Since
exit, raise, and return all send the execution elsewhere in the code,
for completeness we should as for when on goto statements, too, but
maybe they should remain harder to write.

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"English bed-wetting types."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-01-26  0:00 ` Anonymous
@ 1998-01-30  0:00   ` Ray Blaak
  1998-02-01  0:00   ` Robert Dewar
  1 sibling, 0 replies; 9+ messages in thread
From: Ray Blaak @ 1998-01-30  0:00 UTC (permalink / raw)



nobody@REPLAY.COM (Anonymous) writes:

>On Fri, 23 Jan 1998 10:32:51 -0800, "Chris Sparks (Mr. Ada)"
>I submitted a revision request for this:

>raise [exception_name] [when boolean_expression];

>thinking it would be clear, easy to implement, not cause any problem
>with existing Ada-83 code, and be useful. It didn't make it into the
>revised language.

Just generalize it a la Perl, and do:

<statement> [when boolean_expression];

where <statement> is simple (non-compound).

Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
@ 1998-01-31  0:00 tmoran
  1998-01-31  0:00 ` Nick Roberts
  1998-02-01  0:00 ` Robert Dewar
  0 siblings, 2 replies; 9+ messages in thread
From: tmoran @ 1998-01-31  0:00 UTC (permalink / raw)



>raise [exception_name] [when boolean_expression];
How is that different from
  if boolean_expression then raise exception_name;end if;




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-01-31  0:00 tmoran
@ 1998-01-31  0:00 ` Nick Roberts
  1998-02-01  0:00 ` Robert Dewar
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Roberts @ 1998-01-31  0:00 UTC (permalink / raw)



It isn't, it would simply be slightly neater/more convenient.  The analogy
is with the 'exit' statement (see the RM for details).

-- 

== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]


tmoran@bix.com wrote in article <6avo1d$sul@lotho.delphi.com>...
> >raise [exception_name] [when boolean_expression];
> How is that different from
>   if boolean_expression then raise exception_name;end if;
> 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-01-26  0:00 ` Anonymous
  1998-01-30  0:00   ` Ray Blaak
@ 1998-02-01  0:00   ` Robert Dewar
  1 sibling, 0 replies; 9+ messages in thread
From: Robert Dewar @ 1998-02-01  0:00 UTC (permalink / raw)



Jeff said

<<I submitted a revision request for this:

raise [exception_name] [when boolean_expression];
>>

This was indeed, as I remember, in one of the earlier mapping documents,
but was discarded as extraneous in the attempt to keep the scope of the
change general.

Tuck always used to demand that we justify each deletion of this kind with
a sound technical argument that there was something wrong with the feature.

In fact that was often not possible, the problem was not that each feature
was unacceptable, but simply that a giant collection of nice to have but
not necessary changes add up to a lot.

In fact, as we discussed at the time, the request is a bit like demanding
to know what is wrong with the particular piece of straw that breaks the
camel's back :-)

As you look back at each of these features, you will find that, taken in
isolation, they all seem reasonable, as does the above suggestion. You
have to look at the context of the entire proposal.

The older mapping documents are available for perusal if you are 
interested.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-01-31  0:00 tmoran
  1998-01-31  0:00 ` Nick Roberts
@ 1998-02-01  0:00 ` Robert Dewar
  1998-02-14  0:00   ` Corey Ashford
  1 sibling, 1 reply; 9+ messages in thread
From: Robert Dewar @ 1998-02-01  0:00 UTC (permalink / raw)



tmoran said

<<How is that different from
  if boolean_expression then raise exception_name;end if;
>>

Well of course, as we all understand, it is *not* different at all. We
are talking minor convenience here, nothing more. But note that the
above argument would equally well argue against the inclusion of

   exit loopname when <<expression>>

in the language.

I think the reason that we justify it for exit, and not for raise
(and most CERTAINLY not for all simple statements, nasty thought ...)
is that exit is rather special since it is essentially part of the
structure of a loop.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: new language construct proposed
  1998-02-01  0:00 ` Robert Dewar
@ 1998-02-14  0:00   ` Corey Ashford
  0 siblings, 0 replies; 9+ messages in thread
From: Corey Ashford @ 1998-02-14  0:00 UTC (permalink / raw)




Robert Dewar wrote in message ...
>tmoran said
>
><<How is that different from
>  if boolean_expression then raise exception_name;end if;
>>>
>
>Well of course, as we all understand, it is *not* different at all. We
>are talking minor convenience here, nothing more. But note that the
>above argument would equally well argue against the inclusion of
>
>   exit loopname when <<expression>>
>
>in the language.
>
>I think the reason that we justify it for exit, and not for raise
>(and most CERTAINLY not for all simple statements, nasty thought ...)
>is that exit is rather special since it is essentially part of the
>structure of a loop.
>

If you don't like the "if" statement, a procedure call would work too, but
it's not terribly pretty:

procedure Raise_When(Condition : Boolean; Exception_Id:
Ada.Exceptions.Exception_Id; Message : String := "") is
begin
    if Condition then
        Ada.Exceptions.Raise_Exception(Exception_Id, Message);
    end if;
end Raise_When;
pragma inline(Raise_When);

An example usage:

Raise_When(a > 17 and b = 0, Constraint_Error'identity, "Ephemeris Error");

This way you can add a string to the exception if desired.  Also, you could
null out
the body of this routine when you're getting ready to ship, to improve
performance.
Since it's inline, it doesn't cost you much.






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-02-14  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-23  0:00 new language construct proposed Chris Sparks (Mr. Ada)
1998-01-23  0:00 ` Nick Roberts
1998-01-26  0:00 ` Anonymous
1998-01-30  0:00   ` Ray Blaak
1998-02-01  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1998-01-31  0:00 tmoran
1998-01-31  0:00 ` Nick Roberts
1998-02-01  0:00 ` Robert Dewar
1998-02-14  0:00   ` Corey Ashford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox