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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9def0a9c238c7bd8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-12 05:58:07 PST Path: supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!tank.news.pipex.net!pipex!warm.news.pipex.net!pipex!mailsvr!not-for-mail From: steve.folly@rdel.NOT-A-REAL.co.uk (Steve Folly) Newsgroups: comp.lang.ada Subject: Re: Ada 0x Wish List Date: Mon, 12 Feb 2001 13:18:35 GMT Organization: Thales Message-ID: <3a87e143.185542375@news.rrds.co.uk> References: <87u260bba1.fsf@deneb.enyo.de> NNTP-Posting-Host: ntwc1138.int.rdel.co.uk X-Trace: rdel.co.uk 981983913 27890 172.21.185.71 (12 Feb 2001 13:18:33 GMT) X-Complaints-To: postmaster@uk.thalesgroup.com NNTP-Posting-Date: 12 Feb 2001 13:18:33 GMT X-Newsreader: Forte Free Agent 1.21/32.243 Xref: supernews.google.com comp.lang.ada:5159 Date: 2001-02-12T13:18:33+00:00 List-Id: On 12 Feb 2001 08:39:18 +0100, Florian Weimer wrote: >"Peter Richtmyer" writes: > >> 2) In a subroutine, would like to be able to declare variables that >> are "persistent", like C "static" variables and only used by the one >> subroutine. > >This feature wouldn't interoperate with tasking, so I think it's a bad >idea. > But neither do global variables if you're not careful. Just because it's dangerous *if* you're using tasking, doesn't mean you should prohibit it in the language. The LRM describes several areas where doing things like that things will make a program erroneous. There is a way to accomplish static/persistent variables in Ada... Where, for example, you would want... function Count return Natural is C : static Natural := 0; begin C := C + 1; return C; end; Can be achieved .... package Count_Package is function Count return Natural; end Count_Package package body Count_Package is C : Natural := 0; function Count return Natural is begin C := C + 1; return C; end; end Count_Package; function Count return Natural renames Count_Package.Count; -- SF.