comp.lang.ada
 help / color / mirror / Atom feed
* New, and don't understand the error message!
@ 2002-05-15 18:34 Danny Woolston
  2002-05-15 18:35 ` Florian Weimer
  2002-05-16  2:39 ` Pat Rogers
  0 siblings, 2 replies; 10+ messages in thread
From: Danny Woolston @ 2002-05-15 18:34 UTC (permalink / raw)


Hi All

I am really new to ADA and im stuck on a coding cpmplier message, can
anyone shed some light on it?

linked_lists_test.adb: Error: line 6 col 57 LRM:3.9.1(3), The
accessibility level of a record extension shall not exceed that of its
parent; this also applies in a generic instantiation
       (In instance of generic Linked_Lists at linked_lists.ads: line
40 col 10)


Many thanks and i hope someone can help!

Danny
England



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

* Re: New, and don't understand the error message!
  2002-05-15 18:34 New, and don't understand the error message! Danny Woolston
@ 2002-05-15 18:35 ` Florian Weimer
  2002-05-16  1:58   ` Steve Doiel
                     ` (3 more replies)
  2002-05-16  2:39 ` Pat Rogers
  1 sibling, 4 replies; 10+ messages in thread
From: Florian Weimer @ 2002-05-15 18:35 UTC (permalink / raw)


dannywooly@yahoo.co.uk (Danny Woolston) writes:

> I am really new to ADA and im stuck on a coding cpmplier message, can
> anyone shed some light on it?

A tagged type must be declared at the library level.



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

* Re: New, and don't understand the error message!
  2002-05-15 18:35 ` Florian Weimer
@ 2002-05-16  1:58   ` Steve Doiel
  2002-05-16  2:47     ` Pat Rogers
  2002-05-16  2:31   ` Robert Dewar
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Steve Doiel @ 2002-05-16  1:58 UTC (permalink / raw)


"Florian Weimer" <Weimer@CERT.Uni-Stuttgart.DE> wrote in message
news:873cwtxnqv.fsf@CERT.Uni-Stuttgart.DE...
> dannywooly@yahoo.co.uk (Danny Woolston) writes:
>
> > I am really new to ADA and im stuck on a coding cpmplier message, can
> > anyone shed some light on it?
>
> A tagged type must be declared at the library level.

Since Danny said he was new I would add...

The library level is anywhere in the program that is not inside of a
procedure or function (ie: in a package spec or body).

SteveD






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

* Re: New, and don't understand the error message!
  2002-05-15 18:35 ` Florian Weimer
  2002-05-16  1:58   ` Steve Doiel
@ 2002-05-16  2:31   ` Robert Dewar
  2002-05-16  6:17     ` Florian Weimer
  2002-05-16  6:21     ` Florian Weimer
  2002-05-16  2:42   ` Pat Rogers
  2002-05-16 10:58   ` John English
  3 siblings, 2 replies; 10+ messages in thread
From: Robert Dewar @ 2002-05-16  2:31 UTC (permalink / raw)


Florian Weimer <Weimer@CERT.Uni-Stuttgart.DE> wrote in message news:<873cwtxnqv.fsf@CERT.Uni-Stuttgart.DE>...
> dannywooly@yahoo.co.uk (Danny Woolston) writes:
> 
> > I am really new to ADA and im stuck on a coding cpmplier message, can
> > anyone shed some light on it?
> 
> A tagged type must be declared at the library level.

No that's not true (and would be an unnecessary restriction). Tagged types
can be declared (within a package) at any level of nesting. The important
rule is that you cannot extend from a given tagged type at a deeper level
of accessibility. See the AARM for a discussion of why this rule is
necessary from a safety point of view (avoiding dangling procedure
pointers).



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

* Re: New, and don't understand the error message!
  2002-05-15 18:34 New, and don't understand the error message! Danny Woolston
  2002-05-15 18:35 ` Florian Weimer
@ 2002-05-16  2:39 ` Pat Rogers
  1 sibling, 0 replies; 10+ messages in thread
From: Pat Rogers @ 2002-05-16  2:39 UTC (permalink / raw)


"Danny Woolston" <dannywooly@yahoo.co.uk> wrote in message
news:d17ba8b2.0205151034.6f1d1961@posting.google.com...
<snip>
> linked_lists_test.adb: Error: line 6 col 57 LRM:3.9.1(3), The
> accessibility level of a record extension shall not exceed that of its
> parent; this also applies in a generic instantiation
>        (In instance of generic Linked_Lists at linked_lists.ads: line 40 col
10)

In effect the compiler is telling you that a new type (ie, the "record
extension") derived from an existing tagged type (the "parent") cannot be
declared at a more deeply nested level than that of the "parent" type.  For
example, a tagged type declared in a library package can only have extensions
also declared at the library level.  ("Nesting" isn't quite the proper term for
"accessibility level", but it will be close enough to get the idea across.)

The gist of the rationale for the rule is that it precludes any attempt to
dispatch to routines that no longer exist.

Have a look at a good textbook; the error message above is exactly right in what
it is telling you, but the terms it uses are precise and must be understood in
order to know what to do.  (Reading the RM is probably not the best way to
start.)  It is a subtle topic and the textbook will/should explain it at
sufficient length.

---
Patrick Rogers                       Consulting and Training in:
http://www.classwide.com          Real-Time/OO Languages
progers@classwide.com               Hard Deadline Schedulability Analysis
(281)648-3165                                 Software Fault Tolerance







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

* Re: New, and don't understand the error message!
  2002-05-15 18:35 ` Florian Weimer
  2002-05-16  1:58   ` Steve Doiel
  2002-05-16  2:31   ` Robert Dewar
@ 2002-05-16  2:42   ` Pat Rogers
  2002-05-16 10:58   ` John English
  3 siblings, 0 replies; 10+ messages in thread
From: Pat Rogers @ 2002-05-16  2:42 UTC (permalink / raw)


"Florian Weimer" <Weimer@CERT.Uni-Stuttgart.DE> wrote in message
news:873cwtxnqv.fsf@CERT.Uni-Stuttgart.DE...
<snip>

> A tagged type must be declared at the library level.

No, that's too much -- an extension cannot be declared at a deeper level than
the parent, but that does not mean that the parent type must be declared at the
library level.  Yes the common case is to declare tagged types in library
packages, but it is not required.


--
---
Patrick Rogers                       Consulting and Training in:
http://www.classwide.com          Real-Time/OO Languages
progers@classwide.com               Hard Deadline Schedulability Analysis
(281)648-3165                                 Software Fault Tolerance





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

* Re: New, and don't understand the error message!
  2002-05-16  1:58   ` Steve Doiel
@ 2002-05-16  2:47     ` Pat Rogers
  0 siblings, 0 replies; 10+ messages in thread
From: Pat Rogers @ 2002-05-16  2:47 UTC (permalink / raw)


"Steve Doiel" <nospam_steved94@attbi.com> wrote in message
news:3nEE8.9708$gD6.15036@sccrnsc01...
<snip>
> The library level is anywhere in the program that is not inside of a
> procedure or function (ie: in a package spec or body).

That's too restrictive -- a package declaration nested inside another package
(declaration or body) would not be a library package either, for example.





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

* Re: New, and don't understand the error message!
  2002-05-16  2:31   ` Robert Dewar
@ 2002-05-16  6:17     ` Florian Weimer
  2002-05-16  6:21     ` Florian Weimer
  1 sibling, 0 replies; 10+ messages in thread
From: Florian Weimer @ 2002-05-16  6:17 UTC (permalink / raw)


dewar@gnat.com (Robert Dewar) writes:

>> > I am really new to ADA and im stuck on a coding cpmplier message, can
>> > anyone shed some light on it?
>> 
>> A tagged type must be declared at the library level.
>
> No that's not true (and would be an unnecessary restriction).

Ah, I was indeed confused, I meant "controlled type".  (The list
implementation used by the original poster probably uses a controlled
type internally.)



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

* Re: New, and don't understand the error message!
  2002-05-16  2:31   ` Robert Dewar
  2002-05-16  6:17     ` Florian Weimer
@ 2002-05-16  6:21     ` Florian Weimer
  1 sibling, 0 replies; 10+ messages in thread
From: Florian Weimer @ 2002-05-16  6:21 UTC (permalink / raw)


dewar@gnat.com (Robert Dewar) writes:

>> > I am really new to ADA and im stuck on a coding cpmplier message, can
>> > anyone shed some light on it?
>> 
>> A tagged type must be declared at the library level.
>
> No that's not true (and would be an unnecessary restriction).

Ah, I was indeed confused, I meant to write "controlled type".  (The
list implementation used by the original poster probably uses a
controlled type internally.)



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

* Re: New, and don't understand the error message!
  2002-05-15 18:35 ` Florian Weimer
                     ` (2 preceding siblings ...)
  2002-05-16  2:42   ` Pat Rogers
@ 2002-05-16 10:58   ` John English
  3 siblings, 0 replies; 10+ messages in thread
From: John English @ 2002-05-16 10:58 UTC (permalink / raw)


Florian Weimer wrote:
> 
> dannywooly@yahoo.co.uk (Danny Woolston) writes:
> 
> > I am really new to ADA and im stuck on a coding cpmplier message, can
> > anyone shed some light on it?
> 
> A tagged type must be declared at the library level.

Just to amplify: put the declaration of the data types needed for
your generic instantiation, together with the generic instantiation
itself, in a package specification:

   package X is
     type Y is ...;
     package Z is new Linked_Lists(Y);
   end X;

Now say "with X; use X;" at the start of your test program instead
of "with Linked_Lists".

-----------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.it.bton.ac.uk/staff/je
 Dept. of Computing        | ** NON-PROFIT CD FOR CS STUDENTS **
 University of Brighton    |    -- see http://burks.bton.ac.uk
-----------------------------------------------------------------



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

end of thread, other threads:[~2002-05-16 10:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-15 18:34 New, and don't understand the error message! Danny Woolston
2002-05-15 18:35 ` Florian Weimer
2002-05-16  1:58   ` Steve Doiel
2002-05-16  2:47     ` Pat Rogers
2002-05-16  2:31   ` Robert Dewar
2002-05-16  6:17     ` Florian Weimer
2002-05-16  6:21     ` Florian Weimer
2002-05-16  2:42   ` Pat Rogers
2002-05-16 10:58   ` John English
2002-05-16  2:39 ` Pat Rogers

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