comp.lang.ada
 help / color / mirror / Atom feed
* Membership in "set" of characters
@ 1993-03-19 17:06 Debora Weber-Wulff
  1993-03-19 19:57 ` Mark A Biggar
  0 siblings, 1 reply; 8+ messages in thread
From: Debora Weber-Wulff @ 1993-03-19 17:06 UTC (permalink / raw)


This is another one of those "why won't this work?" for the experts.
I'm stumped. As far as I can decode the LRM and
see from 2 textbooks I consulted, this ought to work.

-- muell3.ada
--
-- Why won't membership work here?
--
with text_io; use text_io;

procedure muell3 is
type affirmatives is ('y', 'Y', 'j', 'J', 'o', 'O');
  ch : CHARACTER;
  okay : Boolean;

begin
  get (ch);
  -- The next statement gets flagged with
  -- type clash in membership test [LRM 4.5.2/10]
  okay := ch IN affirmatives;

  -- Is this because there's the clause
  -- for CHARACTER use (1, 2, ... 128) in the standard?

end muell3;

This one was one of my favorites in Pascal! I'm currently 
quite frustrated with the type system after writing a little program
to calculate the return on investment. I had declared
one type for the interest and one for the DM amount, one was a float and
one was a fixed value. After hours of agony to get the conversion right
as the silly FIXEDs needed an explicit conversion after each * and /
I found that 1000 DM (FIXED) * 0.03 (FLOAT) was equal to 31.98 !!!. 
I'd love for the bank to calculate my interest that way! It finally
worked when both were FLOAT values. Now all I wanted to add was a loop
to calculate the values again, and I get blown out of the water by 
Meridian's 4.1 type checker again. 
Is it me? Is it Meridian? Or is this the agony of using Ada?
8
-- 
Debora Weber-Wulff, Professorin fuer Softwaretechnik
snail: Technische Fachhochschule, FB Informatik, 
       Luxemburgerstr. 10, 1000 Berlin 65
email: dww@informatik.tfh-berlin.dbp.de 



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

end of thread, other threads:[~1993-03-23  4:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-03-19 17:06 Membership in "set" of characters Debora Weber-Wulff
1993-03-19 19:57 ` Mark A Biggar
1993-03-22 10:37   ` Andrew Dunstan,,2285592,
1993-03-22 12:22     ` Debora Weber-Wulff
1993-03-22 17:11       ` Robert I. Eachus
1993-03-22 15:49   ` Ada 9X references M. Ramchandran
1993-03-22 21:50     ` Alex Blakemore
1993-03-23  4:16     ` Michael Feldman

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