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,a644fa9cd1a3869a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-12 08:57:00 PST From: "Martin Dowie" Newsgroups: comp.lang.ada References: <3BECA3B7.5020702@telepath.com> <3bef920f@pull.gecm.com> <9soq34$be6$1@nh.pace.co.uk> Subject: Re: List container strawman 1.2 Date: Mon, 12 Nov 2001 16:58:54 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: ed125012.sd.edinbr.gmav.gecm.com Message-ID: <3beffc62@pull.gecm.com> X-Trace: 12 Nov 2001 16:44:18 GMT, ed125012.sd.edinbr.gmav.gecm.com Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!howland.erols.net!newsfeed.mathworks.com!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!ed125012.sd.edinbr.gmav.gecm.com Xref: archiver1.google.com comp.lang.ada:16339 Date: 2001-11-12T16:58:54+00:00 List-Id: "Marin David Condic" wrote in message news:9soq34$be6$1@nh.pace.co.uk... > Lots of ways of handling that. I agree that there are cases where you want a > list to contain only one sample of a given element, but I'd prefer that the > instantiation doesn't force someone to make that decision and have to > provide parameters that may be unnecessary for the simple cases. It could > just as easily be done by providing a subprogram to set a flag in the List > object that disallows/allows duplicates. Or alternately, returning a flag on > insertion indicating there was a duplicate or providing a function to test > for a duplicate, or .... ? IOW, default behavior is "duplicates allowed" > unless you call "Disallow_Duplicates (My_List_Object) ;" or something > similar. Well, the biggest benefit we found with this method was that it allowed the compiler to optimise away various paths on instantiation depending on the parameter passed. You could always have: Elements_Must_Be_Unique : Boolean := False; The actual code difference between the two variants is very small and would save having two package sources to maintain, which would have (almost) exactly the same specification.