comp.lang.ada
 help / color / mirror / Atom feed
From: Christoph Grein <christoph.grein@eurocopter.com>
To: comp.lang.ada@ada.eu.org
Subject: Re: Trouble with renaming types
Date: Wed, 9 May 2001 06:59:32 +0200 (MET DST)
Date: 2001-05-09T06:59:32+02:00	[thread overview]
Message-ID: <mailman.989384766.28367.comp.lang.ada@ada.eu.org> (raw)

Bob, I'm not sure what you're about; your text is too brief and marred with 
errors:

>  WordSet(Dictionary, Word) I get the compilation error:

I gather you mean

  WordSet.Add (Dictionary, Word);

The problem is here that you qualify Add with the wrong prefix. Dictionary is 
not defined in WordSet but in some other parent (let's also call it Parent), and 
you must use the parent name as prefix:

   Parent.Add (Dictionary, Word);

See the following example as further illustration:

generic
  type Formal is private;
package Gen is
  type Stuff is private;
  procedure Primitive (X: in Stuff);
private
  type Stuff is record
    Comp: Formal;
  end record;
end Gen;
---------
with Gen;
package Inst is new Gen (Formal => Integer);  -- want to rename Inst.Stuff
----------
with Inst;
package What_I_want is          -- kind of renaming
  type Goal is new Inst.Stuff;  -- implicitly inherits Primitive operations
end What_I_want;
-----------------
with What_I_want;
procedure Main is
  X: What_I_want.Goal;
begin
  What_I_want.Primitive (X);
end Main;
  
Christoph





             reply	other threads:[~2001-05-09  4:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-09  4:59 Christoph Grein [this message]
2001-05-09 15:15 ` Trouble with renaming types Bob McChesney
  -- strict thread matches above, loose matches on Subject: below --
2001-05-08 15:37 Bob McChesney
2001-05-08 15:45 ` Bob McChesney
2001-05-08 16:45   ` Mark
2001-05-08 17:12     ` Bob McChesney
2001-05-09 13:18 ` Stephen Leake
2001-05-09 15:22   ` Bob McChesney
replies disabled

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