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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-14 09:13:40 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!newsfeed.mathworks.com!news.mathworks.com!uunet!nyc.uu.net!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: List container strawman X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BF2A186.F1911068@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <3BE29AF4.80804@telepath.com> <3BF1A33D.73DE084F@boeing.com> <9su0b3$l3m$1@nh.pace.co.uk> Mime-Version: 1.0 Date: Wed, 14 Nov 2001 16:53:26 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:16522 Date: 2001-11-14T16:53:26+00:00 List-Id: Marin David Condic wrote: > > I don't think I'd characterize it as "complicated" - more like "awkward". In > the past, I've built data structures that would have a "private" flavor and > a "limited private" flavor so that when I had the simple case (assignment > and equality inherently available) I didn't have to go to the effort of > inventing small subprograms or otherwise jockying around the fact that the > limited case was going to insist I provide something that was already there. > > I think the reason for "private" being preferable over "limited private" is > that now we can build things that inherit from Controlled, so if you need to > do something to control behavior on assignment, you can, but you don't have > to for the simple case. Hence, you can save yourself some generic parameters > and make instantiation a simpler matter. (Do you really want to have to > define an "Assign" procedure every time you want to stack up some integers? > Its not complicated - just a pain in the posterior.) > > "Jeffrey Carter" wrote in message > news:3BF1A33D.73DE084F@boeing.com... > > > > If the client has to provide an Assign procedure for the Element type, > > then the Element type should be limited private. While I have no problem > > with this, I think most of the participants in this discussion have > > already decided that's too complicated for them. > > Yes, but I was referring to a comment that suggested an Assign procedure needs to be provided even though Element is private. In that case you might as well make Element limited private since it buys you additional applicability without changing how the component is instantiated. Of course, the real reason not to import Element as private is that it is an incorrect specification, and precise specification is essential to design by contract. A generic package has 2 specifications: the generic formal part, which should specify precisely what the client must provide to use the package, and the package specification, which should specify precisely what services the package provides to its clients. A formal private type specifies that the package requires "=" for type, when in fact a list does not use "=" for its Element type. -- Jeffrey Carter