comp.lang.ada
 help / color / mirror / Atom feed
From: eriks@lin.foa.se (Erik Svensson FOA2)
Subject: Re: How do I avoid 'use' in this case?
Date: Thu, 11 Mar 1993 18:20:21 GMT
Date: 1993-03-11T18:20:21+00:00	[thread overview]
Message-ID: <1993Mar11.182021.1129@lin.foa.se> (raw)
In-Reply-To: 1993Mar11.163904.18135@fcom.cc.utah.edu

val@fcom.cc.utah.edu (Val Kartchner) writes:

>I know that the usage of 'use' is discouraged.  I generally agree, but I do
>not see a way around it in this case.  Is there something that I'm missing?

>We have a package called 'FIELD_DEF' which (among other things) defines a
>variant record type and an access type for referencing it.  Here is the
>text of the errors generated for one of the lines:

>-- Begin included text

> 2693             if (comm_addr_group(i,j) /= NULL) then
>..........................................1
>%ADAC-E-NOTDECLOPOPND, (1) /= is not declared for the given operands [LRM 4.5]
>%ADAC-I-SUPPLOPARGTYPE, (1) Result type of the first (or only) operand of /= is
>        access type field_type_ptr in field_def at line 180
>%ADAC-I-POSSUSECALL1, (1) Possibly a selected component of (or use clause for)
>        package field_def in field_def at line 167 is intended; this would make
>        implicit binary operator /= (field_type_ptr; field_type_ptr) returning
>        BOOLEAN declared in field_def at line 180 visible for a legal call

>-- End included text

>I followed the implied suggestion of the (VAX/VMS) Ada compiler and inserted
>a "use FIELD_DEF;" statement.  I know that with non-operator functions (i.e.:
>functions who's names are alphanumeric + '_'), you can use the package name
>to avoid 'use'.  As far as I know, there is no equivalent for operators.


Use rename instead.
Like this:

        function "/="(A,B:Foo) return boolean renames field_def."/=";

You could do field_def. "/="from the beginning, but that`s not so convinient.


HTH

cheers
--
     Erik Svensson
    Research Officer            National Defense Research Establishment (FOA)
 Guided Weapons Division        Stockholm, Sweden      eriks@fenix.lin.foa.se

"I like maxims that don't encourage behaviour modification." -- Calvin



  parent reply	other threads:[~1993-03-11 18:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-11 16:39 How do I avoid 'use' in this case? Val Kartchner
1993-03-11 18:17 ` MILLS,JOHN M.
1993-03-11 18:20 ` Erik Svensson FOA2 [this message]
1993-03-16 13:12   ` Sandy Wise
1993-03-18  3:02   ` Adam Beneschan
1993-03-11 18:47 ` Arthur Evans
1993-03-12 17:26 ` Gary Morris @ignite
  -- strict thread matches above, loose matches on Subject: below --
1993-03-18 15:58 howland.reston.ans.net!zaphod.mps.ohio-state.edu!uwm.edu!caen!nic.umass.e
replies disabled

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