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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,75f02dbbddbbdc88 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.75.170 with SMTP id d10mr5318653pbw.6.1323964615744; Thu, 15 Dec 2011 07:56:55 -0800 (PST) Path: lh20ni25775pbb.0!nntp.google.com!news1.google.com!postnews.google.com!o7g2000yqk.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Pop function Date: Thu, 15 Dec 2011 07:54:50 -0800 (PST) Organization: http://groups.google.com Message-ID: <0357a0a8-9e3e-4011-bb40-0d82700d70b2@o7g2000yqk.googlegroups.com> References: <27517259.83.1323907586856.JavaMail.geo-discussion-forums@yqgn9> <31100824.174.1323919653265.JavaMail.geo-discussion-forums@yqcs5> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1323964615 16924 127.0.0.1 (15 Dec 2011 15:56:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 15 Dec 2011 15:56:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o7g2000yqk.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-12-15T07:54:50-08:00 List-Id: On Dec 15, 4:43=A0am, Simon Wright wrote: > "Rego, P." writes: > > Ok. So it would be like > > > =A0 =A0procedure Pop (Sender : in out T_List_Ptr; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 T_Item : out Integer) is > > =A0 =A0 =A0Previous_Sender : T_List_Ptr; > [...] > > but in this case I could not call > > =A0 =A0Some_Obj : access T_List; > > =A0 =A0Other_Int : Integer; > > =A0 =A0... > > =A0 =A0Other_Int :=3D Some_Obj.Pop; > > because Pop is not a primitive of T_List. The notation Some_Obj.Pop > > would be just sintatic sugar, but would exist a way we can implement > > Pop for using with this? (but sure...that's also ok for the non-sugar > > case) > > I don't see why Pop takes T_List_Ptr as an argument. I would have > written > > =A0 =A0 procedure Pop (Sender : in out T_List; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0T_Item : out Integer) is > > and then it would be primitive (assuming T_List is tagged). I'm not following. Assuming you have some object that represents a "list", that object is going to have to point to the "head" of the list somehow, and the Pop operation is going to have to change that head. Since the OP has defined T_List as one of the elements of the list, rather than as an object that represents the "list" in its entirety, passing an "in out T_List" isn't going to get the job done. You could quibble about whether T_List is an appropriate name to represent a list element. Fine. I would too. But I think our first objective should get our OP to help write code that works, which involves making sure he (I assume) understands the Ada language issues involved, and not adding to any confusion he might have. We can quibble about the names, readability issues, encapsulation issues, etc., later. -- Adam