comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Discriminated records are not the most efficient, but ...
Date: Mon, 23 Aug 2010 00:07:45 +0200
Date: 2010-08-23T00:07:45+02:00	[thread overview]
Message-ID: <op.vhu027nyule2fv@garhos> (raw)
In-Reply-To: 874oemcr37.fsf@mid.deneb.enyo.de

Le Sun, 22 Aug 2010 22:47:24 +0200, Florian Weimer <fw@deneb.enyo.de> a  
écrit:
> But doesn't that mean that the package you want to pass has to be an
> instance of a generic package?  I haven't seen that programming style
> much.
Yes, as said in 12.7(2)
http://www.adaic.org/standards/05rm/html/RM-12-7.html

So let say it can do it with restrictions (while that's easy to turn any  
package into a generic package, without any formal parameters... but you  
will have to do the same for all child packages).

> (Ada hasn't got another way to express module types, so this shouldn't
> come as a surprise.)
By the way, a generic package does not define a type, so there is no  
module type (if I understand you correctly). In Ada they are all  
compilation units. But they defines an interface, which from an abstract  
point of view make it something like a typed object, for a package  
instance, or something may be a bit like a type for a none-instantiated  
generic package (i.e. the package definition). But you will not be able to  
derive a package from another package (there is nothing like “type package  
Z is new Y with ... end Z;”) ; so this would be rather limited view of a  
type.

However, you have Tagged types and Records which can be derived and have  
primitives and a state just like packages does, but you will not be able  
to define a type inside of a tagged or record definition.

The package in Ada, is really an architectural and organizational element  
(which includes reusability, via generic packages) and does not concretely  
intersect with the type system (except from some abstract point of view).

The only thing I know which would the more look like a package and a type  
in the mean time, is task or protected types. This is more really a type  
(and can indeed be defined like type, while this is not required), as it  
can be used to recursively define another type (a task type may be a  
component of a record, or component of an array as examples) while a  
package cannot (there is nothing like defining a record with a package  
type component or an array of packages).

I am not sure if a task is considered a compilation unit or not (I have  
check the RM, it says No... but I am still not sure, I feel it should be)

Thanks for the interesting point you raised.

(hope I did not said any erroneous things in this reply)



  reply	other threads:[~2010-08-22 22:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21 21:18 Discriminated records are not the most efficient, but Yannick Duchêne (Hibou57)
2010-08-21 21:57 ` Yannick Duchêne (Hibou57)
2010-08-22  5:39   ` Yannick Duchêne (Hibou57)
2010-08-22 20:40     ` Yannick Duchêne (Hibou57)
2010-08-22 20:47       ` Florian Weimer
2010-08-22 22:07         ` Yannick Duchêne (Hibou57) [this message]
2010-08-22 22:11           ` Yannick Duchêne (Hibou57)
2010-08-23  3:06           ` Peter C. Chapin
2010-08-23  3:50             ` Yannick Duchêne (Hibou57)
2010-08-23  6:25               ` J-P. Rosen
2010-08-23  8:09                 ` Yannick Duchêne (Hibou57)
2010-08-23  6:40               ` Niklas Holsti
2010-08-23  7:33                 ` Simon Wright
2010-08-23 11:44                   ` Martin
2010-08-23 13:16                     ` Georg Bauhaus
2010-08-23 13:32                       ` Martin
2010-08-23 17:02                       ` Yannick Duchêne (Hibou57)
2010-08-23  8:13                 ` Yannick Duchêne (Hibou57)
2010-08-23  1:52         ` Yannick Duchêne (Hibou57)
2010-08-23  5:14           ` Yannick Duchêne (Hibou57)
2010-08-23  5:43             ` Florian Weimer
2010-08-23  7:55               ` Yannick Duchêne (Hibou57)
2010-08-23  8:06                 ` Dmitry A. Kazakov
2010-08-23  8:26                   ` Yannick Duchêne (Hibou57)
2010-08-23  8:43                     ` Dmitry A. Kazakov
2010-09-04 18:49             ` Florian Weimer
replies disabled

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