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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6a0391eb7e0327d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-11 16:59:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed1.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Ada style of passing 'in' parameters considered dangerous? Date: Tue, 11 Feb 2003 17:09:24 -0800 Organization: AdaWorks Software Engineering Message-ID: <3E499EC4.4D341E02@adaworks.com> References: <86isvuzabx.fsf@hoastest1-8c.hoasnet.inet.fi> <17cd177c.0302110114.2c46b52@posting.google.com> Reply-To: richard@adaworks.com NNTP-Posting-Host: 41.b2.41.61 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 12 Feb 2003 00:59:27 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:34010 Date: 2003-02-12T00:59:27+00:00 List-Id: Gautier wrote: > I'd suggest that compilers issue a warning when the following > conditions meet: > - there are parameters of the same type, some IN, some [IN] OUT > - the compiler decides to pass the IN by reference > - an IN parameter is referenced after an IN OUT was modified > and also: > - for a call, when the same variable is passed to an IN > by reference and an [IN] OUT (it doesn't solve the issue of > ".all" objects!). There is an interesting, but seldom engaged, principle that any method that modifies an object should do only modification, and any method that queries an object should do only queries. This is difficult in Ada because it does not use the distiguished received model. Therefore, we are often forced to use modes of in out or have a combination of parameters for in and out on the same data type. For limited types, in out is often the only alternative. Therefore, the notion of issuing a warning might serve quite nicely to alert a programmer to a potential problem. Richard Riehle