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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dbf2052c2a878539 X-Google-Attributes: gid103376,public From: Andy Subject: Re: access-to-constant dispatching params Date: 2000/05/08 Message-ID: <3916BA40.3839@nospam.tj>#1/1 X-Deja-AN: 620658871 Cache-Post-Path: news.ozonline.com.au!unknown@melb-pool-158-200.ozonline.com.au Content-Transfer-Encoding: 7bit References: <8f5t2r$g0k$1@nnrp1.deja.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@connect.com.au X-Trace: perki.connect.com.au 957794557 14124 203.4.248.42 (8 May 2000 14:02:37 GMT) Organization: Australia On Line Pty Ltd Mime-Version: 1.0 Reply-To: andt@nospam.tj NNTP-Posting-Date: 8 May 2000 14:02:37 GMT Newsgroups: comp.lang.ada Date: 2000-05-08T14:02:37+00:00 List-Id: m_cubed@my-deja.com wrote: > > Ada provides access-to-variable dispatching > parameters. > > For example: > > procedure Set_Exercise_Mode ( > State_Ptr: access State_Type; > Exercise_Mode: in Exercise_Mode_Type); > > What it doesn't seem to provide is > access-to-constant dispatching parameters. > It would be useful to be able to ensure that > a query on an object is prevented from > accidentally updating the object. For example, > (in hypothetical syntax): > > function Exercise_Mode ( > State_Ptr: access constant State_Type) > return Exercise_Mode_Type; > How about using an in parameter? function Exercise_Mode ( State : in State_Type) return Exercise_Mode_Type; If the code that uses this type are maintaining some sort of structure, list or array of State_Type pointers, one can always dereference: Mode := Exercide_Mode (State => State_Ptr.all); ___________________________________________ Andy ___________________________________________