comp.lang.ada
 help / color / mirror / Atom feed
From: csus.edu!wupost!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!uv aarpa!software.org!smithd@ucdavis.ucdavis.edu  (Doug Smith)
Subject: Re: why are these unknown identifiers?
Date: 11 Sep 91 20:16:07 GMT	[thread overview]
Message-ID: <1991Sep11.201607.3148@software.org> (raw)

In article <9109101616.aa26718@PARIS.ICS.UCI.EDU> jduarte@liege.ICS.UCI.EDU (Jo
se Duarte) writes:
> -----------------------------------------
> package X is
> 	type DIRECTIONS is (UP,DOWN,LEFT,RIGHT);
> end X;
> -----------------------------------------
> with X;
> package Y is
> 	subtype DIRECTIONS is X.DIRECTIONS;

replace the subtype declaration with a derived type:
    type Directions is new X.Directions;
 
> end Y;
> -----------------------------------------

remove extraneous with of Text_IO.

> with Y;
> procedure BUG is
> 
> V1 : Y.Directions := Y.UP;    -- Y.UP is unknown
> V2 : Y.Directions := Y.DOWN;  -- Y.DOWN is unknown
> 
> begin
>   null;
> end BUG;
> 
> Can someone tell me why "Y.UP" and "Y.DOWN" are unknown identifiers
> within the procedure BUG? I have to "with X" and then assign X.UP
> and X.DOWN to V1 and V2 in order to compile this. Why is this the case?
> Is this an Ada pecularity or a compiler bug?
> 
> 
> Thanks!
> JOSE DUARTE

Make the above change from subtype to derived type to
accomplish what you were trying (I didn't see any reason
to with Text_IO).  Of course, you will find other differences
which you may not like, such as the need for explicit
type conversions.

Now you can study the differences between subtypes and
derived types (I have never been able to do better than
the LRM, and will let others "explain" the differences).

             reply	other threads:[~1991-09-11 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-09-11 20:16 csus.edu!wupost!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!uv [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-09-18 14:24 why are these unknown identifiers? & Wise
1991-09-17 14:58 Mr. D. Harter
1991-09-11 21:02 Dave Williamson
1991-09-11 19:24 Greg Harvey
1991-09-11 18:43 Robert I. Eachus
1991-09-11 14:13 agate!spool.mu.edu!news.cs.indiana.edu!arizona.edu!east.pima.edu!rharwood
1991-09-10 23:16 Jose Duarte
replies disabled

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