From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 18 Sep 92 18:45:45 GMT From: concert!samba!usenet@gatech.edu (Frank Prindle) Subject: Relational operations on discrete types / visibility Message-ID: <1992Sep18.184545.25978@samba.oit.unc.edu> List-Id: 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