comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Dispatching and generics - language lawyer question
Date: Mon, 29 Jul 2002 20:38:34 GMT
Date: 2002-07-29T20:38:34+00:00	[thread overview]
Message-ID: <wccvg6yqng5.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: GztAq4.7F6@world.std.com

Hi, Ben.

"Ben Brosgol" <brosgol@world.std.com> writes:

> As another interesting case, suppose that you declare an integer type T with
> "mod" specified as abstract.  If "mod" on the formal type is invoked from
> the generic body, then either the instantiation Ada.Text_IO.Integer_IO(T)
> would need to be rejected (a rather flagrant violation of the "contract
> model") or else the predefined "mod" would need to reemerge.

Yes, that *is* an interesting case, which I hadn't thought of.

Note that for tagged types, the generic declares whether it wants to
accept types with abstract primitive ops, so the instantiation can be
rejected without violating the contract model.  It's uncomfortable that
there are misc. rules like this that distinguish tagged types from
untagged types.  Could we do better if designing the language from
scratch?  (I think many such rules are needed for compatibility with Ada
83.)  I'm not sure what the right answer is in this case.

I'm disappointed that nobody answered my previous question -- what
should the rules about predefined operators in generics be?  I don't
like the current Ada rules (which require reemergence of the "wrong"
operator), but the alternatives are uncomfortable in various ways.
Christoph Grein, or anybody else want to comment?

Here's an interesting case: a generic Sort routine, that takes "<" as a
parameter.  (Or it could be called "Less_Than" -- it doesn't matter what
it's called, or whether it's an operator symbol.)  The Sort routine
might require that the "<" behave in certain ways (like if A<B and B<C
both return True, then A<C should always return True).  Is there any way
to specify that (other than via comments)?  Is there some way to design
the language so that the generic Sort could formally require such
properties of "<"?

This is similar to the Text_IO.Integer_IO example, where the code wants
to assume that "mod" behaves according to some mathematical rules.
(I'm not even sure how to state those rules precisely.)

- Bob



  reply	other threads:[~2002-07-29 20:38 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24  5:33 Dispatching and generics - language lawyer question Grein, Christoph
2002-07-24 22:55 ` Robert A Duff
2002-07-25 15:46   ` Ben Brosgol
2002-07-29 20:38     ` Robert A Duff [this message]
2002-07-31 22:52       ` Dmitry A.Kazakov
2002-07-31 20:18         ` Robert A Duff
2002-08-02  1:15           ` Dmitry A.Kazakov
2002-08-01 16:30             ` Hyman Rosen
2002-08-02 23:42               ` Dmitry A.Kazakov
2002-08-02 15:49                 ` Hyman Rosen
2002-08-02 17:48                   ` Stephen Leake
2002-08-10  3:03                     ` Warren W. Gay VE3WWG
2002-08-05 11:15                   ` Dmitry A. Kazakov
2002-08-12 12:44                   ` Robert Dewar
2002-08-13  2:00                     ` Information Systems Annex was " Robert C. Leif
2002-08-13  8:17                       ` Robert Dewar
2002-08-13 23:53                         ` Information Systems Annex Robert C. Leif
2002-08-13 17:37                       ` Information Systems Annex was RE: Dispatching and generics - language lawyer question Keith Thompson
2002-08-13 23:53                         ` Robert C. Leif
2002-08-14  8:52                           ` Keith Thompson
2002-08-14 21:53                             ` Robert C. Leif
2002-08-15  9:31                               ` Robert Dewar
2002-08-15 21:54                                 ` Decimal Floating point was " Robert C. Leif
2002-08-16  6:26                                   ` Keith Thompson
2002-08-16 16:26                                     ` Robert C. Leif
2002-08-16 18:17                                       ` Keith Thompson
2002-08-16 15:26                                   ` Robert Dewar
2002-08-16 15:29                                   ` Robert Dewar
2002-08-15  9:26                           ` Robert Dewar
2002-08-15 16:17                             ` Darren New
2002-08-15 17:25                               ` David C. Hoos
2002-08-15 17:31                                 ` Darren New
2002-08-15 19:59                                 ` Frank J. Lhota
2002-08-15 17:39                               ` tmoran
2002-08-15 19:18                               ` Information Systems Annex was RE: Dispatching and generics - Larry Kilgallen
2002-08-15 18:41                                 ` Hyman Rosen
2002-08-16 15:49                                 ` Robert Dewar
2002-08-17  6:31                                   ` Simon Wright
2002-08-17 14:17                                     ` Robert Dewar
2002-08-15 21:54                             ` Decimal Floating types was RE: Information Systems Annex was RE: Dispatching and generics - language lawyer question Robert C. Leif
2002-08-16 15:21                               ` Robert Dewar
2002-08-16 16:15                                 ` Decimal Floating types Warren W. Gay VE3WWG
2002-08-17 10:52                                   ` Robert Dewar
2002-08-17 14:30                                     ` Warren W. Gay VE3WWG
2002-08-20  0:26                                       ` Robert Dewar
2002-08-20  2:35                                         ` SteveD
2002-08-22 18:15                                         ` Richard Riehle
2002-08-23  3:23                                           ` Robert Dewar
2002-08-16 15:47                             ` Information Systems Annex (usefulness of Decimal Floats) Warren W. Gay VE3WWG
2002-08-17 10:54                               ` Robert Dewar
2002-08-17 14:06                                 ` Warren W. Gay VE3WWG
2002-08-17 10:56                               ` Robert Dewar
2002-08-17 14:12                                 ` Warren W. Gay VE3WWG
2002-08-17 19:04                                 ` Robert C. Leif
2002-08-20  0:25                                   ` Robert Dewar
2002-08-16 15:38                           ` Information Systems Annex was RE: Dispatching and generics - language lawyer question Robert Dewar
2002-08-13 22:50           ` Randy Brukardt
2002-08-14  0:02             ` Robert A Duff
2002-07-25  0:40 ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2002-07-22 23:13 Adam Beneschan
2002-07-23 15:42 ` Stephen Leake
2002-07-24 15:37   ` Stephen Leake
replies disabled

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