Re: About String
- From: Georg Bauhaus <rm.tsoh.plus-bug.bauhaus@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jun 2008 00:02:51 +0200
Robert A Duff wrote:
"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> 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.What is so special in statement lists? Pushing this idea further, we should
My idea is that every statement list is a scope.
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.
Local in which sense? There are statical nesting and dynamic execution ofHowever I find nested declare/begin/end more readable because it clearlyI don't get it. You declare something inside a loop body, or the 'then'
disambiguates between the scope of the loop and the scope of one iteration
of.
part of an 'if' -- it's local to that.
the loop body upon iterations.
The same sense as declare blocks. That is, in my "circus",
this:
... loop
<decls>
<statements>
end loop;
... loop
Get(Buffer(K));
<decls> -- depending on Buffer
<statements>
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
<decls>
<statements>
end;
end loop;
has identical semantics to:
... loop
declare
<decls>
begin
<statements>
end;
end loop;
... loop
Get(Buffer(K));
declare
<decls>
begin
<statements>
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 <decls> and <statements> 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.
.
- Follow-Ups:
- Re: About String
- From: Robert A Duff
- Re: About String
- References:
- About String
- From: Sébastien Morand
- Re: About String
- From: Simon Wright
- Re: About String
- From: Pascal Obry
- Re: About String
- From: Chris Moore
- Re: About String
- From: Niklas Holsti
- Re: About String
- From: Robert A Duff
- Re: About String
- From: Maciej Sobczak
- Re: About String
- From: Robert A Duff
- Re: About String
- From: Dmitry A. Kazakov
- Re: About String
- From: Robert A Duff
- Re: About String
- From: Dmitry A. Kazakov
- Re: About String
- From: Robert A Duff
- Re: About String
- From: Dmitry A. Kazakov
- Re: About String
- From: Robert A Duff
- About String
- Prev by Date: Re: About String
- Next by Date: Re: About String
- Previous by thread: Re: About String
- Next by thread: Re: About String
- Index(es):
Relevant Pages
|
Loading