comp.lang.ada
 help / color / mirror / Atom feed
* Ada2005 temp solo child (was: Re: The Dreaded "Missing Subunits"
  2002-09-13  8:16 ` Peter Amey
@ 2002-09-13  8:51   ` Peter Hermann
  2002-09-14  2:33     ` Robert A Duff
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Hermann @ 2002-09-13  8:51 UTC (permalink / raw)


Peter Amey <peter.amey@praxis-cs.co.uk> wrote:
> grandparent-parent-unit_name.adb for subunits.

In this context I have a question to language lawyers:
Since it may be practical to temporarily have package children
without having the corresponding parent, why should it be 
prohibited by the standard to allow this?
Likewise e.g. ada.text_io could turn to orphan
since package ada may easily be missing.

While developing an application, I have e.g. a parent.child
but not yet a parent package, which may or may come later.
Now my compiler forces me to have the parent.
I would prefer the ada standard would force the compiler
to allow parentless children.
Did I ignore some important aspect?

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child (was: Re: The Dreaded "Missing Subunits"
@ 2002-09-13  8:59 Grein, Christoph
  2002-09-13 10:24 ` Ada2005 temp solo child ica2ph
  0 siblings, 1 reply; 12+ messages in thread
From: Grein, Christoph @ 2002-09-13  8:59 UTC (permalink / raw)


> While developing an application, I have e.g. a parent.child
> but not yet a parent package, which may or may come later.
> Now my compiler forces me to have the parent.
> I would prefer the ada standard would force the compiler
> to allow parentless children.
> Did I ignore some important aspect?

I do not know, but the request seems silly to me. Why is it so disturbing to create a 
dummy parent, which is still empty. It has to be created anyway eventually, so 
why not just now? If there will never be a parent, why have the hierarchy at 
all?



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13  8:59 Ada2005 temp solo child (was: Re: The Dreaded "Missing Subunits" Grein, Christoph
@ 2002-09-13 10:24 ` ica2ph
  2002-09-13 10:40   ` Preben Randhol
  0 siblings, 1 reply; 12+ messages in thread
From: ica2ph @ 2002-09-13 10:24 UTC (permalink / raw)


In article <mailman.1031907902.8367.comp.lang.ada@ada.eu.org> you wrote:
>> While developing an application, I have e.g. a parent.child
>> but not yet a parent package, which may or may come later.
>> Now my compiler forces me to have the parent.
>> I would prefer the ada standard would force the compiler
>> to allow parentless children.
>> Did I ignore some important aspect?

> I do not know, but the request seems silly to me. Why is it so disturbing to create a 
> dummy parent, which is still empty. It has to be created anyway eventually, so 
> why not just now? If there will never be a parent, why have the hierarchy at 
> all?

Haetten Sie meine Anfrage genau durchgelesen,
dann haetten Sie mich nicht gleich beleidigen muessen.

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 10:24 ` Ada2005 temp solo child ica2ph
@ 2002-09-13 10:40   ` Preben Randhol
  2002-09-13 11:41     ` Peter Hermann
  2002-09-13 16:06     ` Robert A Duff
  0 siblings, 2 replies; 12+ messages in thread
From: Preben Randhol @ 2002-09-13 10:40 UTC (permalink / raw)


On Fri, 13 Sep 2002 12:24:47 +0200 (MDT),
<ica2ph@csv.ica.uni-stuttgart.de> wrote:

> Haetten Sie meine Anfrage genau durchgelesen, dann haetten Sie mich
> nicht gleich beleidigen muessen.

But if you have a parentless child, why isn't the child then the parent?

Preben



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 10:40   ` Preben Randhol
@ 2002-09-13 11:41     ` Peter Hermann
  2002-09-13 13:50       ` Dr. Michael Paus
  2002-09-13 21:00       ` Stephen Leake
  2002-09-13 16:06     ` Robert A Duff
  1 sibling, 2 replies; 12+ messages in thread
From: Peter Hermann @ 2002-09-13 11:41 UTC (permalink / raw)


Preben Randhol <randhol+abuse@pvv.org> wrote:
> But if you have a parentless child, why isn't the child then the parent?

because of a couple of practical aspects:
o  hierarchical grouping (similar to ada.text_io instead of text_io)
o  order of development of the source code
o  parent becoming superfluous in higher versions
o  the concept of far reaching independence of a child is charming, anyway.

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 11:41     ` Peter Hermann
@ 2002-09-13 13:50       ` Dr. Michael Paus
  2002-09-13 15:29         ` Preben Randhol
  2002-09-13 21:08         ` Randy Brukardt
  2002-09-13 21:00       ` Stephen Leake
  1 sibling, 2 replies; 12+ messages in thread
From: Dr. Michael Paus @ 2002-09-13 13:50 UTC (permalink / raw)


Peter Hermann wrote:
> Preben Randhol <randhol+abuse@pvv.org> wrote:
> 
>>But if you have a parentless child, why isn't the child then the parent?
> 
> 
> because of a couple of practical aspects:
> o  hierarchical grouping (similar to ada.text_io instead of text_io)
> o  order of development of the source code
> o  parent becoming superfluous in higher versions
> o  the concept of far reaching independence of a child is charming, anyway.
> 
One might even add that this is common practice in Java for example (where the
problem described here does not exist) to make package names globally unique.
All my packages are child packages of a hierarchy starting at "de.ibpaus" and
these packages are actually empty. Its just Ada which forces me to write two
empty dummy packages to satisfy the compiler.

Michael




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 13:50       ` Dr. Michael Paus
@ 2002-09-13 15:29         ` Preben Randhol
  2002-09-13 21:08         ` Randy Brukardt
  1 sibling, 0 replies; 12+ messages in thread
From: Preben Randhol @ 2002-09-13 15:29 UTC (permalink / raw)


On Fri, 13 Sep 2002 15:50:39 +0200, Dr. Michael Paus wrote:
> One might even add that this is common practice in Java for example (where the
> problem described here does not exist) to make package names globally unique.
> All my packages are child packages of a hierarchy starting at "de.ibpaus" and
> these packages are actually empty. Its just Ada which forces me to write two
> empty dummy packages to satisfy the compiler.
                                      ^^^^^^^^
                                      language ?

Well this makes more sense to me at least. Or you could flip the coin
and say that the compiler must compile two dummy files to satisfy you
;-)

Preben



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 10:40   ` Preben Randhol
  2002-09-13 11:41     ` Peter Hermann
@ 2002-09-13 16:06     ` Robert A Duff
  2002-09-13 16:28       ` Preben Randhol
  1 sibling, 1 reply; 12+ messages in thread
From: Robert A Duff @ 2002-09-13 16:06 UTC (permalink / raw)


Preben Randhol <randhol+abuse@pvv.org> writes:

> But if you have a parentless child, why isn't the child then the parent?

Because it has siblings.  You can't make them *all* be the parent.

- Bob



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 16:06     ` Robert A Duff
@ 2002-09-13 16:28       ` Preben Randhol
  0 siblings, 0 replies; 12+ messages in thread
From: Preben Randhol @ 2002-09-13 16:28 UTC (permalink / raw)


On Fri, 13 Sep 2002 16:06:19 GMT, Robert A Duff wrote:
> Preben Randhol <randhol+abuse@pvv.org> writes:
> 
>> But if you have a parentless child, why isn't the child then the parent?
> 
> Because it has siblings.  You can't make them *all* be the parent.

Well then you can simply do a:

package Superparent is

   Pragma Pure (Superparent);

end Superparent;

can't you?

Preben



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 11:41     ` Peter Hermann
  2002-09-13 13:50       ` Dr. Michael Paus
@ 2002-09-13 21:00       ` Stephen Leake
  1 sibling, 0 replies; 12+ messages in thread
From: Stephen Leake @ 2002-09-13 21:00 UTC (permalink / raw)


Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de> writes:

> Preben Randhol <randhol+abuse@pvv.org> wrote:
> > But if you have a parentless child, why isn't the child then the parent?
> 
> because of a couple of practical aspects:
> o  hierarchical grouping (similar to ada.text_io instead of text_io)

That's what empty parent packages are for. It's only three lines of code!

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child
  2002-09-13 13:50       ` Dr. Michael Paus
  2002-09-13 15:29         ` Preben Randhol
@ 2002-09-13 21:08         ` Randy Brukardt
  1 sibling, 0 replies; 12+ messages in thread
From: Randy Brukardt @ 2002-09-13 21:08 UTC (permalink / raw)


Dr. Michael Paus wrote in message ...
>One might even add that this is common practice in Java for example
(where the
>problem described here does not exist) to make package names globally
unique.
>All my packages are child packages of a hierarchy starting at
"de.ibpaus" and
>these packages are actually empty. Its just Ada which forces me to
write two
>empty dummy packages to satisfy the compiler.


Why would you expect otherwise? The compiler has to look for the
declarations in the parent (in order to determine if the child name is
legal). Ada makes you declare almost everything before use. Why would
this case be different? It doesn't feel much different to me than
saying:

    Int := 10;

and complaining that the compiler shouldn't need a declaration of Int.

               Randy.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Ada2005 temp solo child (was: Re: The Dreaded "Missing Subunits"
  2002-09-13  8:51   ` Ada2005 temp solo child (was: " Peter Hermann
@ 2002-09-14  2:33     ` Robert A Duff
  0 siblings, 0 replies; 12+ messages in thread
From: Robert A Duff @ 2002-09-14  2:33 UTC (permalink / raw)


Peter Hermann <ica2ph@iris16.csv.ica.uni-stuttgart.de> writes:

> Peter Amey <peter.amey@praxis-cs.co.uk> wrote:
> > grandparent-parent-unit_name.adb for subunits.
> 
> In this context I have a question to language lawyers:
> Since it may be practical to temporarily have package children
> without having the corresponding parent, why should it be 
> prohibited by the standard to allow this?

When you say "package A.B is..." you are referring to package A.  The
name A has to refer to some package declaration.  Otherwise the whole
model of visibility in Ada doesn't work (names denote declarations,
sometimes implicit.)  You might also write "with A;" temporarily before
you have written package A.  So you could ask the same question there --
why does the compiler complain when I say "with A;" and A does not
exist.

Therefore, I think what you're really asking for is that if A does not
exist (in the compilation environment), then "package A.B is..." should
mean that an empty package A is implicitly declared.  That could work,
but I don't think it's a good idea:

You can easily write an empty package A if you like.  So why should the
compiler go to extra trouble to invent empty packages out of thin air?

If Robert Dewar were listening, he would no doubt point out that
readability is the key (not the minor pain of *writing* the empty
package).  He's right.  If empty packages were imagined by the compiler,
then when I see "package A.B is..." I have a problem.  Suppose I can't
find the source code for A.  Perhaps I was looking in the wrong
directory.  Or perhaps A is implicitly empty.  How do I (as the reader
of the code) know which it is?

Furthermore, if the compiler is supposed to imagine empty packages,
how empty should they be?  Should they contain "pragma Pure;" by
default?  Perhaps, but suppose I write "package A.B.C is..." and A
exists, but B does not.  A pragma Pure in B might be illegal (because
maybe A is not Pure).

> Likewise e.g. ada.text_io could turn to orphan
> since package ada may easily be missing.

I'm not sure what you mean by that.  Package Ada is predefined in the
RM, and provided by all implementations of Ada.  How could it by
"missing" unless you incorrectly installed your compiler?
Perhaps you mean, package Ada could be implicitly empty in the RM (but
then where does its pragma Pure come from?).  I see no advantage in that
kind of implicit declaration.  (Suppose you were reading the RM, and you
couldn't find the declaration of package Ada anywhere.  Wouldn't that be
confusing?)

> While developing an application, I have e.g. a parent.child
> but not yet a parent package, which may or may come later.
> Now my compiler forces me to have the parent.
> I would prefer the ada standard would force the compiler
> to allow parentless children.
> Did I ignore some important aspect?

The Ada package hierarchy is analogous to directory hierarchies.
It makes perfect sense to have a directory with no files in it,
except nested subdirectories.  But it makes no sense to have a
subdirectory of A when A does not exist.

Therefore, I think it is good that when you refer to A (via "with A;" or
"package A.B is...") the compiler will complain if A does not exist.
If you like, create an empty package A to make the compiler shut up.

- Bob



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-09-14  2:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13  8:59 Ada2005 temp solo child (was: Re: The Dreaded "Missing Subunits" Grein, Christoph
2002-09-13 10:24 ` Ada2005 temp solo child ica2ph
2002-09-13 10:40   ` Preben Randhol
2002-09-13 11:41     ` Peter Hermann
2002-09-13 13:50       ` Dr. Michael Paus
2002-09-13 15:29         ` Preben Randhol
2002-09-13 21:08         ` Randy Brukardt
2002-09-13 21:00       ` Stephen Leake
2002-09-13 16:06     ` Robert A Duff
2002-09-13 16:28       ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
2002-09-12 22:49 The Dreaded "Missing Subunits" Peter Richtmyer
2002-09-13  8:16 ` Peter Amey
2002-09-13  8:51   ` Ada2005 temp solo child (was: " Peter Hermann
2002-09-14  2:33     ` Robert A Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox