From: concert!samba!usenet@gatech.edu (Frank Prindle)
Subject: Relational operations on discrete types / visibility
Date: 18 Sep 92 18:45:45 GMT [thread overview]
Message-ID: <1992Sep18.184545.25978@samba.oit.unc.edu> (raw)
In the following simple example, the second if statement fails because the
"=" is not visible, but the semantically equivalent case statement compiles
without error (yet still implicitly requires the "=" or some combination of
relational operations on the discrete type color_type).
Since the compiler can generate code for the case statement, it can clearly
generate code for the second if statement (i.e. there is no ambiguity to
resolve). So why the inconsistency? (personally, I don't think either
statement should fail, but if one must, both should). The compiler is
VADS 6.0.3.
Sincerely,
Frank Prindle
Prindle@NADC.navy.mil
-------------------------------example follows--------------------------
package color_pkg is
type color_type is (RED, GREEN);
end color_pkg;
with color_pkg;
with text_io;
procedure color_test is
color:color_pkg.color_type:=color_pkg.GREEN;
begin
if(color_pkg."="(color,color_pkg.GREEN))
then
text_io.put_line("GREEN");
end if;
if(color = color_pkg.GREEN) --ERROR HERE (EXPECTED)
then
text_io.put_line("GREEN");
end if;
case color is --WHY NO ERROR HERE?
when color_pkg.GREEN=>text_io.put_line("GREEN");
when others=>null;
end case;
end color_test;
--
The opinions expressed are not necessarily those of the University of
North Carolina at Chapel Hill, the Campus Office for Information
Technology, or the Experimental Bulletin Board Service.
internet: bbs.oit.unc.edu or 152.2.22.80
next reply other threads:[~1992-09-18 18:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-09-18 18:45 Frank Prindle [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-09-22 22:18 Relational operations on discrete types / visibility pa.dec.com!nntpd2.cxo.dec.com!bonmot!wallace
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox