comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: limited allocated classwide types
Date: Fri, 04 Nov 2011 10:18:10 +0100
Date: 2011-11-04T10:18:10+01:00	[thread overview]
Message-ID: <4eb3add2$0$6570$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <e3ca4799-e6e1-42c3-a522-d04b8221979f@er6g2000vbb.googlegroups.com>

On 04.11.11 00:35, Simon Belmont wrote:
>
> I am only months into being an Ada programmer
> and not trying to anything that isn't well described and ostensibly
> supported, so it seems odd that such a basic test case would uncover
> and compiler bug.  Moreover, one of the points of pride is that Ada
> compilers are heavily tested and verified for safety critical apps,
> which this seems to undercut.

Chances are that a traditional way of ensuring the presence
of operations for a type might work better---if presence is all
that you need(*).

Depending, then, on the intent of the solution, one simple solution
could be to state the expectations where and when they must be met:

generic
    type Has_Doo_Operation is new Has_Doo with private;
package Here_We_Go is
    
    procedure System_Function_1
        (Tool : in out Has_Doo_Operation;
         Stuff : Information'Class);
    
    procedure System_Function_2
        (Tool : in out Has_Doo_Operation;
         Stuff : in out Flour;
         More_Stuff : in out Eggs);
    
end Here_We_Go;

and then ensure things by first deriving concrete Foo_Type from
Limited_Controlled and then passing Foo_Type as actual type for the
abstract type or interface Has_Doo_Operation .

  Or, more flexibly,

generic
    type T is limited private;
    with procedure Doo (This : T);
package Here_We_Go is ...

  Etc.
__
(*) For some old history, rhetoric, emotions, and examples see
http://people.cs.kuleuven.be/~dirk.craeynest/ada-mi.html
(I remember having read the phrase "multiple inheritance bug
has bitten again", somewhere in the Ada archives.)





  parent reply	other threads:[~2011-11-04  9:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 22:01 limited allocated classwide types Simon Belmont
2011-11-03 22:50 ` Adam Beneschan
2011-11-03 23:14 ` Simon Wright
2011-11-03 23:35   ` Simon Belmont
2011-11-04  0:30     ` Adam Beneschan
2011-11-04  0:51       ` Adam Beneschan
2011-11-04  7:40     ` Simon Wright
2011-11-04  8:42       ` Dmitry A. Kazakov
2011-11-04  9:18     ` Georg Bauhaus [this message]
2011-11-04  9:53     ` Brian Drummond
2011-11-04 16:39       ` Simon Wright
2011-11-04 18:47       ` Adam Beneschan
2011-11-04 20:03         ` Simon Wright
2011-11-08  4:25         ` Randy Brukardt
2011-11-08 12:10           ` Brian Drummond
2011-11-08 12:35             ` Simon Wright
2011-11-08 13:05               ` Dmitry A. Kazakov
2011-11-10  9:56             ` Álex R. Mosteo
2011-11-04 12:25 ` 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