comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus.rm.tsoh@maps.futureapps.de>
Subject: Re: Bus error
Date: Sat, 30 Jun 2007 19:41:05 +0200
Date: 2007-06-30T19:37:40+02:00	[thread overview]
Message-ID: <468694e4$0$20290$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <wcczm2h5ul2.fsf@shell01.TheWorld.com>

Robert A Duff wrote:
> Georg Bauhaus <bauhaus.rm.tsoh@maps.futureapps.de> writes:
> 
>> Dmitry A. Kazakov wrote:
>>> On Fri, 29 Jun 2007 17:44:22 +0200, Georg Bauhaus wrote:
>>>
>>>> Dmitry A. Kazakov wrote:
>>>>>    function Very_Positive return Integer is
>>>>>    begin
>>>>>        return -1;
>>>>>    end Very_Positive;
>>>>>
>>>>>    Oops : Positive renames Very_Positive; -- This is OK!
> 
>> Oops will at some point raise Constraint error;...
> 
> Dmitry's complaint is the above will NOT raise C_E.

I see, yes, it won't raise at that point. I didn't jump to conclusions about
faulty language design because (1) Ada has new <type> when needed and
(b) using subtypes will, I guess, require some compromises, i.e. range
checks at run time.
So I will get a (possibly surprising) Constraint_Error when I write

  Some_String(Oops).

Positive'image is just as "tolerant". 


>> ...how can a compiler
>> be supposed to known that some Integer function will *always*
>> return non-Positives?
> 
> Indeed!  Likewise, how is the _programmer_ supposed to know?

A programmer may be using Positive when it is clear from the logic
of a program that in a region of the program, function Very_Positive
will indeed compute positive return values from its inputs (and thus
be aptly named). Otherwise, yes, mentioning subtype Positive in the
renaming declaration would not be the best choice.  When in other
circumstances, the function returns values not necessarily positive,
I expect the renaming to mention a different subtype. But OK, 
this subtype name is just a hint of varying value for the reader.


>> ...What makes you think that the programmer
>> who has written the Oops doesn't know what he is
>> doing using a subtype, not a new type?
>>
>> I think it is a program design fault, if a fault at all (or a flaw as
>> Bub Duff notes).
> 
> Yes, I agree with you and with my evil twin Bub ;-)

I'm sorry!  <:-|


-- Georg
Too many scripting language programs, log files, and no sunshine for
too many days here
http://www.boersenspiel.de



  reply	other threads:[~2007-06-30 17:41 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0367891DA5DA7E408D42A860FA002F44B0CC48@sma2901.cr.eurocopter.corp>
2007-06-29  9:35 ` AW: Bus error Duncan Sands
2007-06-29 12:55   ` Dmitry A. Kazakov
2007-06-29 15:37     ` Markus E Leypold
2007-06-29 15:44     ` Georg Bauhaus
2007-06-29 20:07       ` Dmitry A. Kazakov
2007-06-30  1:37         ` Robert A Duff
2007-06-30  8:44           ` Dmitry A. Kazakov
2007-06-30 11:52             ` Georg Bauhaus
2007-06-30 13:16               ` Georg Bauhaus
2007-06-30 14:31               ` Dmitry A. Kazakov
2007-06-30 18:07                 ` Georg Bauhaus
2007-06-30 19:31                   ` Robert A Duff
2007-07-01  9:07                   ` Dmitry A. Kazakov
2007-06-30 15:40               ` Robert A Duff
2007-06-30 17:54                 ` Georg Bauhaus
2007-07-02  8:01           ` Jean-Pierre Rosen
2007-07-02 12:00             ` Dmitry A. Kazakov
2007-07-02 12:30               ` Jean-Pierre Rosen
2007-07-02 14:22             ` Robert A Duff
2007-06-30 13:14         ` Georg Bauhaus
2007-06-30 14:31           ` Dmitry A. Kazakov
2007-06-30 15:34             ` Robert A Duff
2007-07-01  8:34               ` Dmitry A. Kazakov
2007-07-01 15:39                 ` Robert A Duff
2007-07-01 19:41                   ` Dmitry A. Kazakov
2007-06-30 15:29           ` Robert A Duff
2007-06-30 17:41             ` Georg Bauhaus [this message]
2007-06-30 13:31         ` Markus E Leypold
2007-07-02  0:16           ` Robert A Duff
2007-06-29  9:23 AW: " Grein, Christoph (Fa. ESG)
2007-06-29 10:17 ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2007-06-27 14:23 Maciej Sobczak
2007-06-27 15:45 ` Georg Bauhaus
2007-06-27 17:19   ` Maciej Sobczak
2007-06-28  1:58     ` Robert A Duff
2007-06-28 20:06       ` Maciej Sobczak
2007-06-28 21:19         ` Robert A Duff
2007-06-29  8:05           ` Maciej Sobczak
2007-06-29  9:42             ` Georg Bauhaus
2007-06-29 16:59               ` Adam Beneschan
2007-06-30 12:33                 ` Georg Bauhaus
2007-06-30  2:02             ` Robert A Duff
2007-06-29  8:04         ` Dmitry A. Kazakov
2007-06-27 20:02 ` Anh Vo
2007-06-27 20:48   ` Maciej Sobczak
2007-06-28  2:01     ` Robert A Duff
1990-08-27 23:48 BUS ERROR J o s e D u a r t e ! ! !
1990-08-16 14:52 saharbaugh%roo.dnet
1990-08-13 21:11 J o s e D u a r t e !!!
1990-08-10 12:32 bus error saharbaugh%roo.dnet
1990-08-09 14:50 saharbaugh%roo.dnet
1990-08-10 21:38 ` Chuck Peterson
replies disabled

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