Re: Extend Record in Spec and Body



On 16 Oct 2006 08:30:46 -0700, richard.charts@xxxxxxxxx wrote:

Is it possible to extend a record twice in a package?

Yes, but not in the body and each extension would produce a new type.

I'm building a component now that will be mostly reusable. There are a
couple packages that are the same, but for one piece the differences
require different code. However, with the way it is designed, it seems
I could make the package specs the same and only alter the bodies.
I would like to try to hide part of the extended record from the
specification without having to change the operation declarations.

You cannot do it in the body and you cannot do it so that both extensions
were looked as one type. But you can make one extension public and another
private:

type Transient_Object is abstract new HigherPackage.object with record
<public things>
end record;

type Object is new Transient_Object with private;
private
type Object is new Transient_Object with record
<private things>
end record;

Well, if the public things are read-only you could expose them through
getters using the prefix interface (new in Ada 2005), and then move
everything into private.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Extend Record in Spec and Body
    ... couple packages that are the same, but for one piece the differences ... I could make the package specs the same and only alter the bodies. ... type Object is new HigherPackage.object -- This is where I'm not ...
    (comp.lang.ada)
  • [Full-disclosure] [ MDVSA-2008:022 ] - Updated xorg-x11 packages fix multiple vulner
    ... Aaron Plattner discovered a buffer overflow in the Composite extension ... with root privileges on the X.org server. ... The updated packages have been patched to correct these issues. ... GPG public key of the Mandriva Security Team by executing: ...
    (Full-Disclosure)
  • [ MDVSA-2008:022 ] - Updated xorg-x11 packages fix multiple vulnerabilities
    ... Aaron Plattner discovered a buffer overflow in the Composite extension ... with root privileges on the X.org server. ... The updated packages have been patched to correct these issues. ... GPG public key of the Mandriva Security Team by executing: ...
    (Bugtraq)
  • [Full-disclosure] [ MDKSA-2007:103 ] - Updated php packages fix multiple vulnerabilities
    ... Corporate 3.0, Corporate 4.0, Multi Network Firewall 2.0 ... A heap buffer overflow flaw was found in the xmlrpc extension for PHP. ... Updated packages have been patched to prevent this issue. ... GPG public key of the Mandriva Security Team by executing: ...
    (Full-Disclosure)
  • Re: D2006 Source path
    ... The project group is one dir level above the packages. ... the hint show the full path + .pas. ... or extension. ...
    (borland.public.delphi.non-technical)