comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Hiding details and protected types
Date: Tue, 24 Apr 2007 13:18:25 -0500
Date: 2007-04-24T13:18:25-05:00	[thread overview]
Message-ID: <f0lhi0$576$1@jacob-sparre.dk> (raw)
In-Reply-To: aa6l0f.5ji.ln@hunter.axlog.fr

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

"Jean-Pierre Rosen" <rosen@adalog.fr> wrote in message
news:aa6l0f.5ji.ln@hunter.axlog.fr...
> Maciej Sobczak a �crit :
>
> > It is not possible to declare this type in the private part of the
> > protected type (why?),
> Because a protected type is like a record, not like a package.
> You can only declare protected operations and components inside it.

Which only begs the question, why can't you declare a type inside of a
record? Sometimes it would be convenient to do so:
    type Foobar is record
         A : array (1..10) of Integer; -- Illegal!
    end record;

The *real* answer to the question is that Ada does not allow intertwined
type declarations. That's because those bring up all kinds of weird
visibility issues for the predefined operators of the inner type. We don't
want operators being defined in the middle of a record type! You might note
that anonymous access types are allowed in these contexts, but that is OK
because they don't have any operators of their own (thus no complications
deciding where they are defined).

                               Randy.







  reply	other threads:[~2007-04-24 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 13:44 Hiding details and protected types Maciej Sobczak
2007-04-24 15:04 ` Jean-Pierre Rosen
2007-04-24 18:18   ` Randy Brukardt [this message]
2007-04-24 19:16 ` Jeffrey R. Carter
2007-04-24 21:31 ` Georg Bauhaus
replies disabled

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