comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: "Must instantiate controlled types at library level." Why?
Date: Mon, 24 May 2004 11:38:38 +0000 (UTC)
Date: 2004-05-24T11:38:38+00:00	[thread overview]
Message-ID: <c8smru$ed6$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 2hb77mFabusrU1@uni-berlin.de

Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
: Georg Bauhaus wrote:
 
: That's no problem. The type tag could be an index in a multidimensional
: dispatch table.
 
With fallback entries, so you don't have to provide entries for
all m x n x k for a function of (Tm, Tn) -> Tk, I guess, where
m, n, and k the number of types in the respective type trees?

:> If everything that some construct like abstract array indexing needs
:> has to be provided by the implmenting types, this might easily lead
:> to type inflation.
: 
: How it differs from what we have now: [...]
: You have to implement ">" before you instantiate.

You won't have to add a type with an implementation of a
comparison interface. All that is needed is a comparison function,
inheritance/implementation is not involved.

:> I'm not sure whether or not this is better than to
:> define operations based on what the type already has, and near where
:> they are needed.
: 
: You will have this for free with multiple inheritance.

Yes, but it restricts the number of locations where you are allowed
to implement the needed functionality, if you have to implement it.


:> How do you manage to write code so the compiler will know
:> it deals with numbers of the kind required in some algorithm
:> involving Array or MultiArray without whole program analysis?
: 
: You cannot have objects of an abstract type (interface). So what you would
: do to write a program dealing with all kind of numbers? Presently it is
: impossible, so there is nothing to compare with.

OK I was referring to algorithms that only need a certain kind
of number, like somthing that can be done using real numbers or
complex numbers.
Is it impossible to have a generic function that operates on
reals as well as on complex numbers?
 

: I have an idea of ad-hoc supertypes. Instead of making all numbers derived
: from Number, sharing its implementation, which will be either impossible or
: inefficient, we could create such supertypes as necessary *afterwards*. So
: if you want to bring Integer and Float under one roof, you create a common
: non-abstract supertype MyNumber. This would require an implementation for
: MyNumber, which can be made more efficient, because you know all the
: players.

What's wrong with generic units that work like this, with either formal
tagged types or explicit requirements listing with defaults?  ;)
(In Ada200Y you can even have multiple interfaces, IIRC.)

Maybe you want take Eiffel into account, as it has a lot of what you
seem to want, including full multiple inheritance?



  reply	other threads:[~2004-05-24 11:38 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-11 23:04 "Must instantiate controlled types at library level." Why? Peter C. Chapin
2004-05-12  1:03 ` Jeffrey Carter
2004-05-12 10:47   ` Peter C. Chapin
2004-05-12 11:25     ` Ludovic Brenta
2004-05-12 14:41       ` Martin Krischik
2004-05-13  2:20       ` Peter C. Chapin
2004-05-12 11:55     ` Martin Krischik
2004-05-13  2:59       ` Peter C. Chapin
2004-05-13  7:10         ` Martin Krischik
2004-05-13 10:36           ` Peter C. Chapin
2004-05-13 11:18             ` Martin Krischik
2004-05-13 22:27               ` Peter C. Chapin
2004-05-13 22:54               ` Freejack
2004-05-14  7:13                 ` Martin Krischik
2004-05-14 13:50                   ` Xenos
2004-05-14 17:27                     ` Georg Bauhaus
2004-05-14 17:58                       ` Xenos
2004-05-14 18:49                     ` Martin Krischik
2004-05-14 19:40                       ` Xenos
2004-05-14 22:47                         ` Ludovic Brenta
2004-05-15  8:34                           ` Martin Krischik
2004-05-16  2:55                           ` Hyman Rosen
2004-05-16 13:48                             ` Ludovic Brenta
2004-05-17  2:30                               ` Hyman Rosen
2004-05-17  5:39                                 ` Martin Dowie
2004-05-17  7:48                                   ` Ludovic Brenta
2004-05-17 15:01                                     ` Hyman Rosen
2004-05-17 16:31                                       ` Georg Bauhaus
2004-05-17 17:40                                         ` Hyman Rosen
2004-05-17 19:17                                           ` Georg Bauhaus
2004-05-17  6:24                                 ` Martin Krischik
2004-05-17 19:48                                   ` James Kanze
2004-05-18  6:27                                     ` Martin Krischik
2004-05-17 12:33                                 ` Dmitry A. Kazakov
2004-05-17 13:46                                   ` Martin Krischik
2004-05-17 15:03                                     ` Dmitry A. Kazakov
2004-05-17 16:02                                   ` Alexander E. Kopilovich
2004-05-18  7:48                                     ` Dmitry A. Kazakov
2004-05-19  1:20                                       ` Alexander E. Kopilovich
2004-05-19  9:59                                         ` Dmitry A. Kazakov
2004-05-19 12:38                                           ` Hyman Rosen
2004-05-19 13:28                                             ` Dmitry A. Kazakov
2004-05-19 13:09                                           ` Georg Bauhaus
2004-05-19 13:44                                             ` Hyman Rosen
2004-05-19 14:17                                               ` Dmitry A. Kazakov
2004-05-19 14:15                                             ` Dmitry A. Kazakov
2004-05-21 11:39                                               ` Georg Bauhaus
2004-05-21 20:33                                                 ` Dmitry A. Kazakov
     [not found]                                                   ` <c8mkor$rlq$1@a1-hrz.uni-duisburg.de>
2004-05-23  1:28                                                     ` Hyman Rosen
2004-05-23  8:55                                                     ` Dmitry A. Kazakov
2004-05-24 11:38                                                       ` Georg Bauhaus [this message]
2004-05-24 13:57                                                         ` Dmitry A. Kazakov
2004-05-24 14:40                                                           ` Georg Bauhaus
2004-05-25  8:32                                                             ` Dmitry A. Kazakov
2004-05-25 15:47                                                               ` Georg Bauhaus
     [not found]                                   ` <URJ8Eg0vzF@VB1162.spb.edu>
2004-05-17 16:50                                     ` Marius Amado Alves
2004-05-18  8:27                                       ` Dmitry A. Kazakov
2004-05-15 17:20                     ` Pascal Obry
2004-05-13 19:33             ` Randy Brukardt
replies disabled

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