comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Novice Ada Programmer Stumped By Simple Type Declaration!
Date: Sun, 07 Oct 2001 17:07:44 GMT
Date: 2001-10-07T17:07:44+00:00	[thread overview]
Message-ID: <3BC08BD1.8F54D61B@san.rr.com> (raw)
In-Reply-To: x7vwv29jgdv.fsf@smaug.pushface.org

Simon Wright wrote:
> 
> Darren New <dnew@san.rr.com> writes:
> 
> > (Incidentally, this is for the unit-test code for a
> > first-one-to-throw-away project, while I'm learning Ada, so the
> > over-use of "use" isn't as bad as it might be.)
> >
> > Thanks! I can't believe I spent two days trying to figure that one
> > out.
> 
> Not to get at you, but you really should look at those two sentences
> together! Wouldn't it have been more effective to kill the "use" and
> accept the typing?

That's what I'm saying. I tried that also. When I *did* use the
fully-qualified name, I used the wrong one. 

The problem was that I had a nested child package (because it was an
instantiated generic package) that I was forgetting to put on there. The
routine I was trying to use was not in scope. GNAT was suggesting a
different routine, or that my arguments were in the wrong order. It
didn't matter whether I had any "use" or not, since I wasn't using the
package I was trying to reference anyway. 

It was just one of those "the first time you do this, it'll take a day
to figure out why you're getting an error."  

Kind of like in C when you use an uninitialized pointer, and when you
put in printf's to see why it's dumping core, it stops dumping core. You
can spend days on that the first time too. :-)

> GNAT will often tell you that it would be able to resolve a reference
> if only you put in a particular "use", best to qualify the name
> properly IMHO ..

The problem is when you start having packages like
package Beep.Core.Profiles.Instantiations.Buffers, and you get calls
like
 
Beep.Core.Profile.Instantiations.Buffer.Queue(Beep.Core.Profiles.Instantiations.Frame_Buffer,
Beep.Core.Control.In_Buffer.Next_Frame.all);

I think a couple of "use" clauses there would help. Or a less
heirarchical package mechanism or something.
 
-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
                   Who is this Dr. Ibid anyway, 
                  and how does he know so much?



  reply	other threads:[~2001-10-07 17:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-04 19:19 Novice Ada Programmer Stumped By Simple Type Declaration! Darren New
2001-10-04 19:50 ` Ted Dennison
2001-10-04 21:33   ` Darren New
2001-10-05 15:27     ` Ted Dennison
2001-10-06  8:56     ` Simon Wright
2001-10-07 17:07       ` Darren New [this message]
2001-10-07 20:50         ` Lutz Donnerhacke
2001-10-05  4:32   ` Robert Dewar
2001-10-05 15:19     ` Ted Dennison
2001-10-05 16:30       ` Darren New
replies disabled

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