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-Thread: 103376,91276ec2ea911d3f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 06 Sep 2006 21:46:58 -0500 From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Generic procedures and their parameters Date: Wed, 6 Sep 2006 19:47:14 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Response Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-fWu8B/wxsnc07gd1wCy+mZ9N8mSUWYsB9gWd0up5BojC9LzYKTmSPRt8gqEwUJX+Cg9wnMepl0Aq8y3!EaGlbSfWYQyXCI/KKD0J4s1+XHS/FQ+2NhwAkdNF65fa/oS3mp72txuawz+Kk5JiVTpGHkLGRp81!NiVKbgGU+l9CPg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:6488 Date: 2006-09-06T19:47:14-07:00 List-Id: "Maciej Sobczak" wrote in message news:edm273$fee$1@sunnews.cern.ch... > Hi, > > I have found the following signature for the sorting procedure: > > eneric > type Index_Type is (<>); > type Element_Type is private; > type Array_Type is array (Index_Type range <>) of Element_Type; > with function "<" (Left, Right : in Element_Type) return Boolean is <>; > procedure Sort(To_Sort : in out Array_Type); > > My question is: what's the purpose of the third parameter (Array_Type)? > Isn't it implied by the first two and therefore just redundant? > I prefer: generic type Index_Type is (<>); type Collection_Type is private; firstIndex : Index_Type; lastIndex : Index_Type; with function In_Order( list : Collection_Type; i, j : Index_Type ) return Boolean; procedure Swap( list : in out Collection_Type; i, j : Index_Type ); procedure Sort( list : in out Collection_Type ); This avoids the declaration of the array altogether, and is usable for any list that may be referenced by index. My 2 cents. Steve (The Duck) > > -- > Maciej Sobczak : http://www.msobczak.com/ > Programming : http://www.msobczak.com/prog/