comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: Ada 0y wish list: "with private"
Date: Thu, 15 Feb 2001 04:18:30 GMT
Date: 2001-02-15T04:18:30+00:00	[thread overview]
Message-ID: <3A8B5891.363B6B44@acm.org> (raw)
In-Reply-To: mailman.982199233.21988.comp.lang.ada@ada.eu.org

"Beard, Frank" wrote:
> 
> What I have
> long wished for is to be able to do the following:
> 
>    package A is
> 
>       type B is private;
> 
>    private
> 
>       type B;  -- If the completion is not here,
>                -- then it's deferred to the body
> 
>    end A;
> 
>    package body A is
> 
>       type B is ...;
> 
>    end A;
> 
> This would allow the separation of the spec and body without
> the bother of using an access type, and the associated dangling
> memory and garbage collection issues.

Yes, or even

package A is
   type B is private;
   -- operations on B
end A;

package body A is
   type B is ...;
end A;

I submitted this as a 9X revision request, but it was rejected on the
grounds that one can achieve the same effect with an access type:

package A is
   type B is private;
   -- operations on B
private
   type X;
   type Y is access all X;
   type B is new Finalization.Controlled with record
      Z : Y;
   end record;
   -- procedures Initialize, Adjust, and Finalize
end A;

However, this is qualitatively different. I want to be able to use B as
B, and not have to get into all the details of it actually being an
access type. Let the compiler deal with all that. I suppose this would
involve a certain amount of work for compiler developers for what such
developers see as a small gain.

-- 
Jeff Carter
"Sons of a silly person."
Monty Python & the Holy Grail



  reply	other threads:[~2001-02-15  4:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-15  1:04 Ada 0y wish list: "with private" Beard, Frank
2001-02-15  4:18 ` Jeffrey Carter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-15 19:16 Beard, Frank
2001-02-15  4:53 Christoph Grein
2001-02-12 13:41 Thierry Lelegard
2001-02-13  0:10 ` Keith Thompson
2001-02-13  0:13 ` Jeff Creem
2001-02-13  6:37   ` Dale Stanbrough
2001-02-13 12:01     ` Jeff Creem
2001-02-13  8:48 ` Dr Adrian Wrigley
2001-02-13  8:56 ` Michel Gauthier
2001-02-13 16:31 ` Ehud Lamm
replies disabled

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