comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@adaos.worldonline.co.uk>
Subject: Re: List Container Straw Man
Date: Sun, 11 Nov 2001 03:48:00 -0000
Date: 2001-11-11T03:48:00+00:00	[thread overview]
Message-ID: <9sktgl$134npc$2@ID-25716.news.dfncis.de> (raw)
In-Reply-To: 9sk0mc$39j$1@news.huji.ac.il

"Ehud Lamm" <mslamm@mscc.huji.ac.il> wrote in message
news:9sk0mc$39j$1@news.huji.ac.il...
> ...
> My problem is on a more semantic level. To understand your approach
students
> must understand about inheritance (or so it seems to me). It is not like
> instanating Integer_IO, which results in having "normal" procedures.
> ...

Not really. Having cited the magic incantation:

   package Widget_Iteration is new SCL.Iteration(Widget_Type);
   package Widget_Lists is new SCL.Lists.Unbounded(Widget_Iteration);
   subtype Widget_List is Widget_Lists.Unbounded_List;

your students can (at first) use the type Widget_List straightforwardly
without having to touch upon anything to do with inheritance, e.g.:

   L: Widget_List;
   W: Widget_Type;
   ...
   while not End_of_File(F) loop
      Read_Widget(F,W);
      Append(L,W); -- add to end of list L
   end loop;

and so on. Later on in the course (much later), when they have done tagged
types, inheritance, abstract types, generic packages, signature packages,
etc., you can then introduce them to the idea of defining a procedure that
can work with different container types, e.g.:

   function Count (
      Widget: in Widget_Type;
      Within: in out Widget_Iteration.Sequence_Producer'Class) return
Natural;

and so on.

--
Best wishes,
Nick Roberts






  reply	other threads:[~2001-11-11  3:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-06 16:45 List Container Straw Man Nick Roberts
2001-11-06 17:29 ` Stephen Leake
2001-11-06 18:25   ` Marin David Condic
2001-11-06 23:02     ` Nick Roberts
2001-11-07 19:49       ` Stephen Leake
2001-11-07 20:30         ` Marin David Condic
2001-11-07 23:58           ` Nick Roberts
2001-11-08  4:34             ` Jeffrey Carter
2001-11-08 10:45             ` Ehud Lamm
2001-11-08 19:09               ` Nick Roberts
2001-11-09 16:32                 ` Ted Dennison
2001-11-10  2:20                   ` Nick Roberts
2001-11-10 19:50                     ` Ehud Lamm
2001-11-11  3:48                       ` Nick Roberts [this message]
2001-11-08 10:41           ` Ehud Lamm
2001-11-08 19:20             ` Marin David Condic
2001-11-08 20:35               ` Ehud Lamm
2001-11-09 16:39             ` Ted Dennison
2001-11-08  0:06         ` Nick Roberts
2001-11-09 16:16           ` Stephen Leake
2001-11-09 16:24             ` Ehud Lamm
2001-11-09 16:52               ` Brian Rogoff
2001-11-09 18:04             ` Darren New
2001-11-09 20:05               ` Stephen Leake
2001-11-10  3:24             ` Nick Roberts
2001-11-06 23:52   ` Nick Roberts
2001-11-07  4:44     ` A question and a request Eric Merritt
2001-11-07 11:00       ` Preben Randhol
2001-11-07 12:54         ` David C. Hoos, Sr.
2001-11-08  2:35           ` dale
2001-11-07 13:24         ` Eric Merritt
2001-11-07 13:58       ` James Rogers
2001-11-07 16:32       ` Jeffrey Carter
2001-11-09 23:32       ` Matthew Heaney
replies disabled

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