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-Thread: 103376,86c750b8474bf6d5 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 17 Jun 2008 00:02:51 +0200 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: About String References: <484ABED3.8040909@obry.net> <484b802a$0$23844$4f793bc4@news.tdc.fi> <12uzegqkwihil.gi8iceyncrph.dlg@40tude.net> <1v6vlmvr3u3dj.qtfnfe9fmxjm.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4856e30c$0$7535$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 17 Jun 2008 00:02:52 CEST NNTP-Posting-Host: 9695b013.newsspool1.arcor-online.net X-Trace: DXC=2DdAcYa1]a:^8FBo0_81f>ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg22VdASdnX5P6PCY\c7>ejV84TKf^d54j\4nQO]Si`\JN8 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:729 Date: 2008-06-17T00:02:52+02:00 List-Id: Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> On Sun, 15 Jun 2008 18:06:00 -0400, Robert A Duff wrote: >> >>> I don't see why a loop needs a declarative part. >>> My idea is that every statement list is a scope. >> What is so special in statement lists? Pushing this idea further, we should >> also conclude that any sequence of expressions is a scope. For example, an >> aggregate: >> >> String'(X : constant Character := F(A(I)), 1 => X, 2 => 'a', 3 => X); >> >> a function call etc. > > Well, I suppose something like that could work, but it seems like it > would be confusing -- how many components are there, which pieces of > text belong to which components (or which parameters, in the function > call case)? > >> [ That might be useful to overcome some silly limitations on discriminants: >> >> type T (S : Storage_Count) is record >> -- Buffer : Storage_Elements_Array (0..S-1); -- This would be illegal, so >> Buffer : Storage_Elements_Array >> (Last : constant Storage_Offset := S-1, 0..Last); >> end record; ] > > I don't see the point. Why not just make it legal (the line marked > "This would be illegal"). Rules would be needed about when to evaluate > that expression -- presumably on elaboration of a discriminant > constraint, or an aggregate, or a discriminant default. I don't think > having a name for Last makes this any easier. > >>>> However I find nested declare/begin/end more readable because it clearly >>>> disambiguates between the scope of the loop and the scope of one iteration >>>> of. >>> I don't get it. You declare something inside a loop body, or the 'then' >>> part of an 'if' -- it's local to that. >> Local in which sense? There are statical nesting and dynamic execution of >> the loop body upon iterations. > > The same sense as declare blocks. That is, in my "circus", > this: > > ... loop > > > end loop; ... loop Get(Buffer(K)); -- depending on Buffer end loop; I guess that in order to maintain the order(?) SCOPE [DECLS] STATEMENTS END-SCOPE we would be needing ... loop Get(Initial(K)); begin end; end loop; > has identical semantics to: > > ... loop > declare > > begin > > end; > end loop; ... loop Get(Buffer(K)); declare begin end; end loop; Compared to the solution above, that would be an exchange of BEGIN <-> DECLARE and the addition of a BEGIN where there is nothing between and above. A quick shot at syntax, what impact does this have, if any? I'm adding a few rather artificial errors, but nevertheless: ... scope function Foo(N: Integer := K); return Value; end scope; ... scope declare function Foo(N: Integer := K); return Value; begin null; end; end scope; By no more than a gut feeling I'd say that from a syntax point of view, the omission of explicit declare blocks adds a few more opportunities for ambiguity: RETURN is at least not likely introducing a statement in the second example.