comp.lang.ada
 help / color / mirror / Atom feed
* Re: Ada 95 Modular Types Question 4.5.1(2)
  1997-11-26  0:00 ` Tucker Taft
@ 1997-11-26  0:00   ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1997-11-26  0:00 UTC (permalink / raw)



Gordon's example is clearly illegal, and GNAT correctly diagnoses it:

test_example.adb:7:10: operator for type "Unsigned_Byte" defined at example.ads:
3 is not directly visible
test_example.adb:7:10: use clause would make operation legal





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ada 95 Modular Types Question 4.5.1(2)
@ 1997-11-26  0:00 Thomas A Peterson
  1997-11-26  0:00 ` Tucker Taft
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas A Peterson @ 1997-11-26  0:00 UTC (permalink / raw)



If I define a modular type in a package and use the type in another
compilation unit are the logical operators visible by default?

The GNAT compiler and Rational Apex compiler differ with respect to the
visibility of the logical operators and I would like to send someone a bug
report.

Here is an example...

package Example is 

  type Unsigned_Byte is mod 256;

end Example;


with Example;
procedure Test_Example is
  A : Example.Unsigned_Byte := 11;
  B : Example.Unsigned_Byte := 37;
  C : Example.Unsigned_Byte;
begin
  C := A or B;
--C := Example."or"(A, B);
end Test_Example;

Thanks, Tom




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada 95 Modular Types Question 4.5.1(2)
  1997-11-26  0:00 Ada 95 Modular Types Question 4.5.1(2) Thomas A Peterson
@ 1997-11-26  0:00 ` Tucker Taft
  1997-11-26  0:00   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Tucker Taft @ 1997-11-26  0:00 UTC (permalink / raw)



Thomas A Peterson (tap@htc.honeywell.com) wrote:

: If I define a modular type in a package and use the type in another
: compilation unit are the logical operators visible by default?

There is nothing special about the logical operators of modular types.
To get direct visibility on the primitive operators of any type,
you need to "use" the package where the type is declared,
or "use type" a subtype of the type, or do local renames of the operators.

: The GNAT compiler and Rational Apex compiler differ with respect to the
: visibility of the logical operators and I would like to send someone a bug
: report.

: Here is an example...

: package Example is 

:   type Unsigned_Byte is mod 256;

: end Example;


: with Example;
: procedure Test_Example is
:   A : Example.Unsigned_Byte := 11;
:   B : Example.Unsigned_Byte := 37;
:   C : Example.Unsigned_Byte;
: begin
:   C := A or B;
           ^^
If the compiler accepts this it has a bug (albeit a "friendly" one ;-).

: --C := Example."or"(A, B);
: end Test_Example;

: Thanks, Tom

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-11-26  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-26  0:00 Ada 95 Modular Types Question 4.5.1(2) Thomas A Peterson
1997-11-26  0:00 ` Tucker Taft
1997-11-26  0:00   ` Robert Dewar

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