comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Michael Paus" <paus@ib-paus.com>
Subject: Re: Small question concerning use
Date: Thu, 18 Oct 2001 20:46:34 +0200
Date: 2001-10-18T18:42:34+00:00	[thread overview]
Message-ID: <3BCF238A.3CE2A5C5@ib-paus.com> (raw)
In-Reply-To: 19130ae.0110151428.65937d5b@posting.google.com

I wonder why in these discussions about the use of "use" people
always use more or less trivial examples. I think for these
examples the issue is more or less a matter of taste. The real
problem with "use" arrises if you make intensive use of object
oriented features in Ada. E.g. if you have a package "My_Pack_A"
in which you define a tagged type "My_Class_A" and another
package "My_Pack_B" in which you define a tagged type "My_Class_B"
which is derived from "My_Class_A". Now assume that B inherits
a method "My_Method" from A. If you now have an instance
of the B class and you want to call one of its methods, say

   B : My_Pack_B.My_Class_B;
   xxx.My_Method(B, Some_Value);

So what is the right package name to put in for xxx? When you
have found out you certainly admit that this may be quite
cunfusing although there is of course a clear logic behind it.

My experience is that if you intensively use object oriented
features the use of "use" quickly becomes a pain in the ...:-)
And if you are interested I can give you examples where in this
particular case the use of "use" resulted in severe bugs in the
code which were very hard to track down. Also the use of "use type"
does not help here because it only makes the operators of a type but
not the primitive methods of a class type visible.

Michael



      parent reply	other threads:[~2001-10-18 18:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-15 22:28 Small question concerning use Eric Merritt
2001-10-16  6:34 ` Rename is much better Petter Fryklund
2001-10-16 12:28 ` Small question concerning use Marc A. Criley
2001-10-16 13:27 ` Ted Dennison
2001-10-16 19:31   ` Darren New
2001-10-16 20:26     ` Ted Dennison
2001-10-16 21:26       ` David Starner
2001-10-17  0:18         ` tmoran
2001-10-17  2:48           ` Darren New
2001-10-17 10:52             ` Larry Kilgallen
2001-10-17 13:48             ` Ted Dennison
2001-10-17 14:21         ` Ted Dennison
2001-10-16 20:35     ` Ted Dennison
2001-10-16 13:54 ` Marin David Condic
2001-10-18 18:46 ` Dr. Michael Paus [this message]
replies disabled

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