comp.lang.ada
 help / color / mirror / Atom feed
From: ae@sei.cmu.edu (Arthur Evans)
Cc: val@fcom.cc.utah.edu (Val Kartchner)
Subject: Re: How do I avoid 'use' in this case?
Date: Thu, 11 Mar 1993 13:47:09 EST
Date: 1993-03-11T13:47:09-05:00	[thread overview]
Message-ID: <1993Mar11.134709.13838@sei.cmu.edu> (raw)
In-Reply-To: val@fcom.cc.utah.edu's message of Thu, 11 Mar 93 16:39:04 GMT

val@fcom.cc.utah.edu (Val Kartchner) asks how, without a 'use' clause,
to get visibility to equality and other operators on objects of a type
declared in another package.

Suppose you have

    package DEFS is
	type X is ...
    end DEFS;

    -- ----------------------------

    with DEFS;
    procedure USER is
	P, Q: X;
    begin
	...
	if P = Q ...		// #1 ILLEGAL
	if DEFS."="(P, Q) ...	// #2 Qualification to get visibility

#1 is the problem you had.  #2 is a way to use dot qualification of an
operator.  It's perhaps a bit ugly, but it works and is convenient if
there are very few uses of the operator in package USER.

However, there's another way to go if there are lots of uses of the
operators.

    with DEFS;
    procedure USER is
	P, Q: X;
	function "="(Left, Right: in X) return boolean renames DEFS."=";
    begin
	...
	if P = Q ...		// Now legal

Art Evans
----------------------------------------------
Arthur Evans, Jr, PhD           Ada Consultant
461 Fairview Road
Pittsburgh PA  15238-1933
412-963-0839
ae@sei.cmu.edu



  parent reply	other threads:[~1993-03-11 18:47 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
1993-03-16 13:12   ` Sandy Wise
1993-03-18  3:02   ` Adam Beneschan
1993-03-11 18:47 ` Arthur Evans [this message]
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