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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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-7-bit Received: by 10.68.75.170 with SMTP id d10mr7309076pbw.6.1324023838553; Fri, 16 Dec 2011 00:23:58 -0800 (PST) Path: lh20ni28388pbb.0!nntp.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Pop function Date: Fri, 16 Dec 2011 09:23:30 +0100 Organization: cbb software GmbH Message-ID: <16dpw88jruv36.woma9en920t8$.dlg@40tude.net> References: <27517259.83.1323907586856.JavaMail.geo-discussion-forums@yqgn9> <1kofjewuvxn4n.xiil34dbjf9i$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2011-12-16T09:23:30+01:00 List-Id: On Thu, 15 Dec 2011 21:02:09 +0000, Simon Wright wrote: > "Dmitry A. Kazakov" writes: > >> On Thu, 15 Dec 2011 12:57:47 -0700, Jeffrey Carter wrote: >> >>> On 12/15/2011 01:38 AM, Dmitry A. Kazakov wrote: >>>> On Wed, 14 Dec 2011 17:34:57 -0700, Jeffrey Carter wrote: >>>> >>>>> Your public interface should never use access types. >>>> >>>> Yes, but since list as a data structure has the semantics of objects >>>> accessed by references it would make sense to have this reflected in the >>>> interface. But of course the list element must be >>>> >>>> type List_Item is access Integer; -- Only the data, no other mess >>> >>> No, a public interface should never use access types, ever. Hiding >>> those is what abstraction is about. Any public interface that uses >>> access types is poorly designed. >> >> In that case there should be no linked lists at all. A linked list is per >> its definition a set of elements accessed using pointers. > > I don't think that using the word "linked" in the name is the same as > "using access types in the abstraction"! Not exactly same, right, but still it assumes referential semantics of the list elements. Access type is one possible implementation of. > I've seen linked lists that were implemented (under the hood) with > indices into an array of items. In that case the index must be exposed in the interface, or a private type encapsulating that index. The bottom line, you need some referential object to refer the list element in the interface. You cannot have linked lists defined solely in the terms of element values. List elements have an identity. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de