From: alex@MIMSY.CS.UMD.EDU (Alex Blakemore)
Subject: Re: Ada question: access types
Date: 5 Oct 92 02:33:12 GMT [thread overview]
Message-ID: <60887@mimsy.umd.edu> (raw)
In article <1992Oct4.211734.9047@seas.gwu.edu> nreich@seas.gwu.edu (Norman Reic
h) writes:
Assume
package my_types is
> TYPE ptr IS ACCESS node;
> TYPE node IS
> RECORD
> name ...
> ...
> nextn :ptr;
> END RECORD;
> nl :ptr;
and in another library unit
> if (nl = NULL) then --error at this line
> type clash in parameter to "="
type ptr is probably in a different package than the if statement.
you probably made type ptr visible via a with clause and did not
make it _directly_ visible via a use clause. this is probably the
most common "error" new users hit and Ada9X is more forgiving here.
The error message could be better though.
Remember the function "=" (left, right : ptr) is implicitly
defined just after the definition of type ptr.
Your choices are:
a. invoke "=" using dotted infix notation.
if my_types."=" (nl, null) then
b. make my_types."=" directly visible by adding a use clause.
use my_types;
c. rename my_types."=" to make it directly visible
function "=" (left, right : my_types.ptr) renames my_types."=";
--
---------------------------------------------------
Alex Blakemore alex@cs.umd.edu NeXT mail accepted
next reply other threads:[~1992-10-05 2:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1992-10-05 2:33 Alex Blakemore [this message]
-- strict thread matches above, loose matches on Subject: below --
1992-10-05 15:38 Ada question: access types Kevin Simonson
1992-10-04 21:17 Norman Reich
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox