comp.lang.ada
 help / color / mirror / Atom feed
* Defect with formal package parameters
@ 2008-06-19 15:14 Eric Hughes
  2008-06-19 19:49 ` Simon Wright
  2008-06-19 22:48 ` Georg Bauhaus
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Hughes @ 2008-06-19 15:14 UTC (permalink / raw)


GNAT 2008 (just installed) fails to compile the following example,
which was cut down from existing code to isolate the problem.  This is
the error message.
> foo.ada-spec:16:34: actual for "Operation" in actual instance does not match formal

Changing the syntax to eliminate "others =>", which is what the
commented-out line does, allows the example to compile without error.
Unfortunately, that's not a viable workaround, because the real code
requires named parameters.

At present I am assuming this is a defect with GNAT 2008 rather than
with the Ada 2005 language definition.  I had the identical problem
with GNAT 2007.  I had stopped development back then, a few months
ago, in the apparently-misplaced hope that a new compiler version
would fix this.

I should point out, for those without significant experience in
generic programming, that this defect completely blocks a huge class
of generic layering techniques that are primarily of interest to
library authors.  Code that does not admit significant reconfiguration
does not require this technique.

Eric
=======================================================
package Foo is
   pragma Elaborate_Body( Foo ) ;

   generic
      with procedure Operation is <> ;
   package Signature is end ;

   procedure Operation_Actual is null ;
   package Impl is new Signature( Operation => Operation_Actual ) ;

   generic
      with package S is new Signature( others => <> ) ;
      -- with package S is new Signature( <> ) ;
   package Module is end ;

   package M is new Module( S => Impl ) ;
end ;
=======================================================



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Defect with formal package parameters
  2008-06-19 15:14 Defect with formal package parameters Eric Hughes
@ 2008-06-19 19:49 ` Simon Wright
  2008-06-21 18:42   ` Eric Hughes
  2008-06-19 22:48 ` Georg Bauhaus
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Wright @ 2008-06-19 19:49 UTC (permalink / raw)


Eric Hughes <eric.eh9@gmail.com> writes:

> At present I am assuming this is a defect with GNAT 2008 rather than
> with the Ada 2005 language definition.  I had the identical problem
> with GNAT 2007.

You don't mention the Bugzilla (or other) reference you reported this
under?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Defect with formal package parameters
  2008-06-19 15:14 Defect with formal package parameters Eric Hughes
  2008-06-19 19:49 ` Simon Wright
@ 2008-06-19 22:48 ` Georg Bauhaus
  2008-06-20 17:25   ` Eric Hughes
  1 sibling, 1 reply; 5+ messages in thread
From: Georg Bauhaus @ 2008-06-19 22:48 UTC (permalink / raw)


Eric Hughes wrote:
> GNAT 2008 (just installed) fails to compile the following example,
...
> =======================================================
> package Foo is
>    pragma Elaborate_Body( Foo ) ;
> 
>    generic
>       with procedure Operation is <> ;
>    package Signature is end ;
> 
>    procedure Operation_Actual is null ;
>    package Impl is new Signature( Operation => Operation_Actual ) ;
> 
>    generic
>       with package S is new Signature( others => <> ) ;
>       -- with package S is new Signature( <> ) ;
>    package Module is end ;
> 
>    package M is new Module( S => Impl ) ;
> end ;
> =======================================================

Another workaround:

package Foo is
   pragma Elaborate_Body( Foo ) ;

   generic
      with procedure Operation is <> ;
   package Signature is end ;

   procedure Operation is null ;
   package Impl is new Signature ;

   generic
      with package S is new Signature( others => <> ) ;
   package Module is end ;

   package M is new Module( S => Impl ) ;
end ;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Defect with formal package parameters
  2008-06-19 22:48 ` Georg Bauhaus
@ 2008-06-20 17:25   ` Eric Hughes
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Hughes @ 2008-06-20 17:25 UTC (permalink / raw)


Eric Hughes wrote:
>    procedure Operation_Actual is null ;
>    package Impl is new Signature( Operation => Operation_Actual ) ;

On Jun 19, 4:48 pm, Georg Bauhaus <rm.tsoh.plus-
bug.bauh...@maps.futureapps.de> wrote:
> Another workaround:
>
>    procedure Operation is null ;
>    package Impl is new Signature ;

The whole point is that I was stacking these package instantiations
two layers deep, and this would cut out the second layer.

Eric



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Defect with formal package parameters
  2008-06-19 19:49 ` Simon Wright
@ 2008-06-21 18:42   ` Eric Hughes
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Hughes @ 2008-06-21 18:42 UTC (permalink / raw)


On Jun 19, 1:49 pm, Simon Wright <simon.j.wri...@mac.com> wrote:
> You don't mention the Bugzilla (or other) reference you reported this
> under?

Please feel free to do so.

Eric





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-21 18:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-19 15:14 Defect with formal package parameters Eric Hughes
2008-06-19 19:49 ` Simon Wright
2008-06-21 18:42   ` Eric Hughes
2008-06-19 22:48 ` Georg Bauhaus
2008-06-20 17:25   ` Eric Hughes

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