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,1e369abf7da96fac,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.99 with SMTP id gp3mr3436915pbc.1.1326365097110; Thu, 12 Jan 2012 02:44:57 -0800 (PST) Path: lh20ni173424pbb.0!nntp.google.com!news2.google.com!postnews.google.com!do4g2000vbb.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Pure function aspect?... Date: Thu, 12 Jan 2012 02:44:56 -0800 (PST) Organization: http://groups.google.com Message-ID: <1d74a186-2599-4de5-af49-ffca2529ea96@do4g2000vbb.googlegroups.com> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 X-Trace: posting.google.com 1326365096 25442 127.0.0.1 (12 Jan 2012 10:44:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Jan 2012 10:44:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: do4g2000vbb.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALERCFNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:10.0) Gecko/20100101 Firefox/10.0,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-01-12T02:44:56-08:00 List-Id: Now Ada has bitten the bullet and allowed "in out" mode parameters in functions, is it time to allow users to contract the other extreme and allow a function to be declared Pure (no state changes, not even hidden ones)? e.g. package P is type T is tagged private; function Pure_F (Self : T) return Integer with Pure; function Impure_F (Self : T) return Integer; private type T is tagged record I : Integer := 0; end record; end P; Functions with a Pure contract would be allowed to call other functions with pure contracts, read values/parameters but promise to change nothing (not even via 'tricks' a la random number generator!!). -- Martin