From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c49ff480209334c X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Inheritance question... Date: 1997/03/24 Message-ID: #1/1 X-Deja-AN: 227982551 References: <33361956.4F30@pacbell.net> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-03-24T00:00:00+00:00 List-Id: In article <33361956.4F30@pacbell.net>, Marc Bejerano wrote: >when I try to create a descendent type in my main procedure I get: > > "type extension at deeper accessibility level than parent" > >here's my "simplified" main procedure: > >with foo; use foo; > >procedure foofoo is > type my_bar is new bar1 with record > s: string(1..128); > end record; >what am I doing wrong? Bar1 is declared at library level. My_Bar is declared one level deeper -- within a procedure. This can cause dangling references, and is therefore not allowed. You should put My_Bar in a library package, not inside a procedure. Basically, "deepness" is a count of how many procedures, functions, block statements, and tasks you're inside -- packages don't count. The fact that it's the main procedure is irrelevant -- it's still a procedure. Note that in Ada, code can execute after the main procedure has returned -- namely, library tasks keep going, and if they got their hands on an object whose tag was My_Bar'Tag, they could reference stuff that no longer exists. - Bob