From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: advice on package design
Date: Thu, 17 Mar 2005 21:48:40 +0100
Date: 2005-03-17T21:48:34+01:00 [thread overview]
Message-ID: <bnx9t6it9qu3$.1m46b77mgj9ua.dlg@40tude.net> (raw)
In-Reply-To: wcc7jk6rsvg.fsf@shell01.TheWorld.com
On 17 Mar 2005 14:10:11 -0500, Robert A Duff wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> On 17 Mar 2005 09:04:26 -0500, Robert A Duff wrote:
>>
>>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>>
>>>> I agree with the idea, but I think that hiding should appear in a
>>>> declarative part. Less probably it should also qualify the thing being
>>>> hidden (like renames does):
>>>
>>> I don't believe in declarative parts. I think declare/begin/end
>>> should not be required just because I want to declare a constant
>>> or something.
>>
>> Disagree. I don't like the idea of something changing its meaning within
>> the same scope, even if that is non-existing -> exiting. I have to tolerate
>> this in a declarative region because probably there is no better way to do
>> it. But I don't want to let it leak out of the quarantine zone.
>
> I don't understand what you mean about "changing meaning".
> I just want to be able to write things like:
>
> for I in A'Range loop
Until here --> This_Component = nothing
> This_Component: constant T := A(I);
Below --> This_Component = constant T
> ... several uses of This_Component
> end loop;
>
> without adding three extra (useless) lines of code.
> And we agreed that if there's another thing called This_Component,
> this This_Component should not hide that This_Component.
Maybe it is a matter of taste, but it is one of things in C++ which I hate
the most. It is very difficult (to me) to understand a program with mixed
declarations and statements.
If you care about extra lines, then I'd propose:
for I in A'Range -- All declarations be between for...loop
This_Component: constant T := A(I);
loop
... several uses of This_Component
end loop;
> The "hide" command I proposed is of dubious value, but if it were
> allowed, I wouldn't mind restricting it to whole procedures
> or something. Or not. But either way, I don't like the separation
> of "declarations" and "statements".
I like the separation very much.
But let's consider getting rid of declarations. Wouldn't it be fake anyway?
You know that better than me, but I suppose the compiler will need to move
everything to the beginning of the closest scope. Otherwise:
if Halt(x) then
declare A;
end if;
Foo (A); -- Would it be legal?
T := (1, 2, 4, declare X := 9, others => declare Y := 10);
-- What would be this? How many Y's could be here?
So I see no advantage in this.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-03-17 20:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-07 16:23 advice on package design spambox
2005-03-07 21:08 ` Dmitry A. Kazakov
2005-03-08 12:48 ` spambox
2005-03-08 17:18 ` Dmitry A. Kazakov
2005-03-12 19:57 ` Robert A Duff
2005-03-12 20:45 ` Dmitry A. Kazakov
2005-03-12 21:59 ` Robert A Duff
2005-03-13 9:23 ` Dmitry A. Kazakov
2005-03-16 20:41 ` Robert A Duff
2005-03-17 10:22 ` Dmitry A. Kazakov
2005-03-17 14:04 ` Robert A Duff
2005-03-17 15:59 ` Dmitry A. Kazakov
2005-03-17 19:10 ` Robert A Duff
2005-03-17 19:47 ` Martin Dowie
2005-03-17 20:55 ` Robert A Duff
2005-03-17 21:14 ` Marius Amado Alves
2005-03-18 9:31 ` Martin Dowie
2005-03-18 9:38 ` Martin Dowie
2005-03-21 16:19 ` Robert A Duff
2005-03-17 20:48 ` Dmitry A. Kazakov [this message]
2005-03-17 21:26 ` Robert A Duff
2005-03-18 3:06 ` Jared
2005-03-18 10:00 ` Dmitry A. Kazakov
2005-03-21 16:17 ` Robert A Duff
2005-03-21 18:16 ` Dmitry A. Kazakov
2005-03-21 20:35 ` Robert A Duff
2005-03-22 10:55 ` Dmitry A. Kazakov
2005-03-17 23:23 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox