comp.lang.ada
 help / color / mirror / Atom feed
* Re: Access Discriminants
@ 1993-06-30  8:49 munnari.oz.au!metro!basser.cs.su.oz.au!news.adelaide.edu.au!achilles!andr
  0 siblings, 0 replies; only message in thread
From: munnari.oz.au!metro!basser.cs.su.oz.au!news.adelaide.edu.au!achilles!andr @ 1993-06-30  8:49 UTC (permalink / raw)


My previous question on this apparently didn't make it onto the net
(or at least I can't see it in the old articles!). So, at the risk of
annoying people, I am reposting it.


In comp.lang.ada, stt@spock.camb.inmet.com (Tucker Taft) writes:
>
>    type Set is limited private;
>      -- Abstract "Set" of Item_Type type
>    procedure Add_Item(To : in out Set; Item : Item_Type);
>    . . .
>
>    type Set_Iterator(Over : access Set) is limited private;
>      -- Iterator over a given set, designated by the access discrim
>    procedure Start(Iterator : in out Set_Iterator);
>      -- (Re)Start iteration at "beginning" of set identified
>      -- by Iterator.Over
>    function More(Iterator : Set_Iterator) return Boolean;
>      -- return True if more items left in iteration.
>    procedure Get_Next(Iterator : in out Set_Iterator;
>                       Item : out Item_Type);
>      -- Get next item in the iteration.
>

Let's say type Set is private instead of limited private. As I
understand it, this is OK - it is the type Iterator that must be
limited private in order to have an access discriminant.

Now, say we have

  function some_func(The_Set : in set) return something is
  ...

Can I create an iterator over The_Set? It is not aliased, so it
appears that I can't, directly. I could make an aliased copy, but this
seems a bit round-about.

cheers

andrew
#  Andrew Dunstan                   #   There's nothing good or bad   #
#  net:                             #                                 #
#    adunstan@steptoe.adl.csa.oz.au #   but thinking makes it so.     #
#  or: andrewd@cs.adelaide.edu.au   #                                 #

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-06-30  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-06-30  8:49 Access Discriminants munnari.oz.au!metro!basser.cs.su.oz.au!news.adelaide.edu.au!achilles!andr

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