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-Thread: 103376,7ae8393ad9100e97 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.189.233 with SMTP id gl9mr10119420pbc.8.1324076005501; Fri, 16 Dec 2011 14:53:25 -0800 (PST) Path: lh20ni30680pbb.0!nntp.google.com!news1.google.com!postnews.google.com!q9g2000yqe.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada2012 : When to use expression functions rather than function bodies? Date: Fri, 16 Dec 2011 14:52:01 -0800 (PST) Organization: http://groups.google.com Message-ID: <12acbf57-01fc-43dd-8881-d39c2a63146b@q9g2000yqe.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1324076005 17369 127.0.0.1 (16 Dec 2011 22:53:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 16 Dec 2011 22:53:25 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q9g2000yqe.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-12-16T14:52:01-08:00 List-Id: On Dec 16, 2:01=A0pm, Jeffrey Carter wrote: > On 12/16/2011 05:25 AM, Martin wrote: > > > Are there any good arguments for *not* replacing all simple, single > > line functions that don't [directly] access package body state > > information with expression functions? > > Are there any good arguments for expression functions? Quote from AI05-0177-1 (http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ ai05s/ai05-0177-1.txt?rev=3D1.13): With the advent of pre and postconditions (see AI05-0145-1), and conditional expressions (see AI05-0147-1), expressions in specifications are going to grow much larger and become more complicated. It is important that parts of such expressions can be abstracted. Abstraction of expressions is usually done by introducing functions. However, this puts the expression in the body, rather than the specification. This has several negative side-effects: -- Hiding of the expression from the compiler and other tools that primarily process specifications; -- Requiring the body to exist in order to do static analysis of the pre/post conditions (meaning static analysis cannot be performed early in the development of a system or on the use of skelton [sic] placeholder packages). -- Introduction of otherwise unnecessary bodies and/or otherwise unnecessary inline body dependencies (increasing system build times). Apparently the ARG thought this was a good argument. I'm not endorsing it personally -- I don't have a particular opinion -- but it appears sensible on its face. -- Adam