comp.lang.ada
 help / color / mirror / Atom feed
From: Tobias Ritzau <Tobias.Ritzau@masda.hv.se>
Subject: Tagged types and static dispatching
Date: 1996/12/02
Date: 1996-12-02T00:00:00+00:00	[thread overview]
Message-ID: <32A2E972.28AF@masda.hv.se> (raw)


Hi everyone!

I have some trouble understanding some featers of Ada 95. I wrote a
small package with a linked list and a list iterator. Of course I wanted
the types to be tagged so that I could expand them later on. When I
compiled my package I got an error message saying:
  operation can be displatching in only one type
The error was on the restart procedure below.

package list is
 
   type List is tagged private;
   type ListIt is tagged private;
 
   procedure insert(l : in out List; el : in T);
   function length(l : in List) return Natural;
  
   procedure restart(li : in out ListIt; l : in List);
   procedure next(li : in out ListIt);
   function atend(li : in ListIt) return Boolean;
   function item(li : in ListIt) return T;

private
   ...
 
I removed the tagged keyword from the iterator and then everything
compiled ok. Then I reinserted the tagged word and replaced the
parameter types by ListIt'Class and List'Class and again everything
compiled ok.
If I have understood things correctly the Class attributes enables
dynamic binding and I don't want to use dynaimc binding. Why can't I use
two tagged types as parameters to a sub-program? What is the correct way
to do this?

Thank you for helping me

Tobias Ritzau




             reply	other threads:[~1996-12-02  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-02  0:00 Tobias Ritzau [this message]
1996-12-02  0:00 ` Tagged types and static dispatching Paul Chardon
1996-12-05  0:00 ` John English
replies disabled

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