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,96ae138aab3beb03 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-01 18:50:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.algonet.se!algonet!news2.tninet.se!not-for-mail From: Stefan Skoglund Newsgroups: comp.lang.ada Subject: Re: Localized Variable Declaration Date: Sun, 02 Jun 2002 03:52:16 +0200 Organization: Telenordia/Algonet Message-ID: <3CF97A50.F37E39AB@ebox.tninet.se> References: <3CF77998.9040806@yahoo.com> NNTP-Posting-Host: sdu78-254.ppp.algonet.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: green.tninet.se 1022982663 15138 195.163.254.78 (2 Jun 2002 01:51:03 GMT) X-Complaints-To: abuse@algonet.se NNTP-Posting-Date: Sun, 2 Jun 2002 01:51:03 +0000 (UTC) To: David Rasmussen X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: sv,en,en-US Xref: archiver1.google.com comp.lang.ada:25182 Date: 2002-06-02T03:52:16+02:00 List-Id: David Rasmussen wrote: > excels at), is the ability to declare a variable "anywhere". In C++ we > can declare a variable exactly when it is needed, which is easier to ok everyone told you about declar .. begin .. end ; like: procedure foo is i: integer; begin ... declare i:float; begin -- i is now a float .. end; -- is now an integer end foo; the other thing about declare is that you can control visibility with it. Lets take ada.strings.bounded as an example -- with ada.strings.bounded; procedure foo is wanted_length: integer; begin ada.integer_textio.get(wanted_length); -- now you need a bounded string with length 20 declare the_string: string[wanted_length]; -- tadaam the discriminan must be variable -- which it really isn't. begin do something with the_string end; end foo; Or was i wrong about things ???