From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df03e50c9b0ea255,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-26 15:57:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!wn3feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc03.POSTED!not-for-mail From: Caffeine Junky Subject: On functions and access types. Newsgroups: comp.lang.ada User-Agent: Pan/0.11.3 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: ALL Message-ID: NNTP-Posting-Host: 12.245.48.122 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1025132234 12.245.48.122 (Wed, 26 Jun 2002 22:57:14 GMT) NNTP-Posting-Date: Wed, 26 Jun 2002 22:57:14 GMT Organization: AT&T Broadband Date: Wed, 26 Jun 2002 22:57:18 GMT Xref: archiver1.google.com comp.lang.ada:26728 Date: 2002-06-26T22:57:18+00:00 List-Id: In a related post where I asked for help with Generics I posted this spec file... generic Max : Positive; type Item is private; package genstack is type Stack is limited private; procedure Push(X : in Item; S : in out Stack); function Pop(S: in Stack) return Item; function Is_Empty(S : in Stack) return Boolean; private type Cell; type Stack is access Cell; type Cell is record Value: Item; Next: Stack; end record; -- This package will be expanded to include other forms of stacks -- -- as time permits. -- end genstack; Now, function Pop was written thusley... function Pop(S : in Stack) return Item is X : Item; begin X := S.Value S := S.Next; return X; end Pop; Now the compiler tells me that I cannot assign to an 'in' parameter. However, as I understand it, a function can only take an 'in' parameter. I can copy S to a stack which is local to the function, but results in the function only returning the last item in the stack. If I use a procedure, it works fine. But I run into problems whenever I try to use similiar acess types into a function. I'm definitely overlooking something here. Probably something obvious. I'll continue to search through my book for an answer, but any pointers or references would be appreciated. Now, eventually I changed this to a procedure for the sake of expediancy. But I'm continuing to work on the problem. Thanks for your patience. Staple