comp.lang.ada
 help / color / mirror / Atom feed
From: amiram@TAURUS.BITNET.UUCP
Subject: language problem
Date: Thu, 26-Mar-87 12:30:29 EST	[thread overview]
Date: Thu Mar 26 12:30:29 1987
Message-ID: <8703261730.AA28726@taurus> (raw)

A colleague of mine, Yossi Veler of AITECH has come up with the following
program in Ada, which seems to create a serious problem.

procedure boolsub is
   subtype bool is boolean range true..true;
   type arr is array(1..10) of bool;
   a : arr := (1..10 => true); -- this seems like the only legal value
begin
   a := not a;
-- Here a(1)=a(2)=...=a(10)= FALSE !!!! No exception occurs etc.
   a := (1..10 => false);
-- This does cause an exception
end boolsub;

The program seems legal : we inspected the LRM and also the implementers
guide, and we ran it on both the DDC and VERDIX compilers. It seems that
a combination of innocent features in Ada produces a result that seems to
contradict with the basic philosophy of the language, that is an object
posseses a value which is not in the appropriate type.

It seems that several features interact to produce this undesirable situation:
1) Boolean is an enumerated type, and one can take a subtype of it.
2) Boolean array operations, which are the only ones operating on all elements
of an array.
3) At run time, array assignements are not checked element by element ( I
believe in all but this case this check is indeed not required ).

Has anyone noticed this before? Is there a way out of it?

             reply	other threads:[~1987-03-26 17:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-03-26 17:30 amiram [this message]
1987-04-01 15:05 ` language problem joe
1987-04-01 20:12   ` cjh
  -- strict thread matches above, loose matches on Subject: below --
1987-04-01 23:58 ms8k#
1987-04-03  0:52 ` deller
     [not found] <12291366595.33.BRYAN@Sierra.Stanford.EDU>
1987-04-02 20:22 ` ROSENBLUM
1987-04-03 14:49   ` dday
1987-04-06 13:26     ` eric
1987-04-03 10:35 ms8k#
1987-04-07  5:53 drw
1987-04-08  1:11 ` keith
1987-04-08 18:08 drw
replies disabled

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