From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: "use" clauses and Ada 95 OOP
Date: 1996/07/23
Date: 1996-07-23T00:00:00+00:00 [thread overview]
Message-ID: <EACHUS.96Jul23175154@spectre.mitre.org> (raw)
In-Reply-To: EACHUS.96Jul19102232@spectre.mitre.org
In article <31F170FC.672C@csehp3.mdc.com> "James A. Squire" <m193884@CSEHP3.MDC.COM> wrote:
> Very interesting! Let me see if I'm reading you right:
> 1. func would have to be a primitive operation in order to be a
> dispatching call. Right?
> 2. Therefore, func would be covered by the "use type" clause on
> <type_of_x>, right?
> I liked the idea of "use type" when I thought it only referred to
> implicit operations like "&", "+", "=" (operations that I wish the Ada
> designers had made a part of the language proper so we wouldn't have any
> need for the use clause). Now that it seems "use type" applies to all
> primitive operations (some of which are user-written, like "Handle",
In article <JSA.96Jul22154610@alexandria> jsa@alexandria (Jon S Anthony) writes:
> A use_type clause only gives "direct" visibility to primitive _operators_
> of the type: RM 8.4(8).
The reality is somewhere in the middle.
RM 3.2.3(8): "A primitive subprogram whose designator is an
operator_symbol is called a _primitive_operator_."
RM 3.2.3(1): "The _primitive_operations of a type are the
predefined operations of the type, plus any user-defined primitive
subprograms."
So yes, this "trick" only works for 21 specific names. But there
are lots of cases where using these symbols (including and, or, xor,
"&", mod, rem, abs, not) make lots of sense for abstract data types.
For example, take a set abstraction. All but two operations
(Is_Empty and Empty) are best defined as Ada operators. (Note also
that function "+"(L: Set; R: Element) return Set; can be a primitive
operator of either Set or Element depending on where it is defined.)
--
Robert I. Eachus
with Standard_Disclaimer;
use Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...
next prev parent reply other threads:[~1996-07-23 0:00 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-17 0:00 "use" clauses and Ada 95 OOP Mitch Gart
1996-07-19 0:00 ` Robert I. Eachus
1996-07-23 0:00 ` Robert I. Eachus [this message]
1996-07-25 0:00 ` JamesS1889
1996-07-23 0:00 ` JamesS1889
1996-07-23 0:00 ` Robert Dewar
1996-07-24 0:00 ` Robert I. Eachus
1996-07-24 0:00 ` Jon S Anthony
1996-07-19 0:00 ` James A. Squire
1996-07-22 0:00 ` Stephen Schmid
1996-07-23 0:00 ` Laurent Guerby
1996-07-23 0:00 ` Robert A Duff
1996-07-23 0:00 ` JamesS1889
1996-07-23 0:00 ` Mitch Gart
1996-07-23 0:00 ` Robert A Duff
1996-07-23 0:00 ` Robert Dewar
1996-07-25 0:00 ` JamesS1889
1996-07-26 0:00 ` Robert A Duff
1996-07-23 0:00 ` Kevin J. Weise
1996-07-23 0:00 ` JamesS1889
1996-07-23 0:00 ` Kevin J. Weise
1996-07-23 0:00 ` JamesS1889
1996-07-24 0:00 ` Jon S Anthony
1996-07-24 0:00 ` Jon S Anthony
1996-07-19 0:00 ` Jon S Anthony
1996-07-20 0:00 ` James A. Squire
1996-07-21 0:00 ` Robert A Duff
1996-07-22 0:00 ` Jon S Anthony
1996-07-23 0:00 ` Jon S Anthony
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox