comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@acm.nospam.org>
Subject: Re: Pointers explained?
Date: Mon, 30 Jul 2007 21:31:33 GMT
Date: 2007-07-30T21:31:33+00:00	[thread overview]
Message-ID: <VMsri.28864$Xa3.587@attbi_s22> (raw)
In-Reply-To: <1185818189.689914.159900@x40g2000prg.googlegroups.com>

shaunpatterson@gmail.com wrote:
> ------- OKAY sorry... I tried to tab in and accidentally activated the
> POST button ----

Once you get used to the de facto Ada standard of never using tabs in 
source, you won't have this problem.

> Now - my solution was to re-write my message factory to return a type
> Message'Class.  However, I went
> to change my callback structure to:
> 
> type CallbackEvent is
> record
>     msg : Message'Class
> end record;

> and I get the message "unconstrained subtype in component declaration"

Right, 'Class is always an unconstrained subtype. However, you can 
declare objects of an unconstrained subtype, provided you provide an 
initial value. The object takes its constraints from the initial value:

S : String := "abc";

Similarly, if you define a function F that returns Message'Class, you 
can declare objects of the subtype:

M : Message'Class := F;

This may or may not help you, because you still can't have components of 
an unconstrained subtype. If you need a component, you will need access 
types. Then good practice is to hide the use of access types from your 
package's clients.

-- 
Jeff Carter
"Have you gone berserk? Can't you see that that man is a ni?"
Blazing Saddles
38



  parent reply	other threads:[~2007-07-30 21:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30 17:53 Pointers explained? shaunpatterson
2007-07-30 17:56 ` shaunpatterson
2007-07-30 19:04   ` Ed Falis
2007-07-30 19:05   ` Ludovic Brenta
2007-07-30 19:36   ` Adam Beneschan
2007-07-30 21:23     ` Maciej Sobczak
2007-07-30 22:36       ` Adam Beneschan
2007-07-31  7:33         ` Dmitry A. Kazakov
2007-07-31  1:15       ` Anh Vo
2007-07-30 22:20     ` Adam Beneschan
2007-07-30 21:31   ` Jeffrey R. Carter [this message]
2007-07-31 17:21   ` Simon Wright
2007-07-31 18:06     ` Dmitry A. Kazakov
2007-07-31 22:38       ` shaunpatterson
2007-08-01  7:53         ` Martin Krischik
2007-08-01  8:21         ` Dmitry A. Kazakov
2007-08-10 19:52         ` Simon Wright
2007-07-30 20:11 ` Dmitry A. Kazakov
2007-07-31  8:28 ` Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2007-07-30 17:53 shaunpatterson
replies disabled

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