comp.lang.ada
 help / color / mirror / Atom feed
* Ada 2012 and type access to in out functions
@ 2011-10-11 12:00 David Sauvage
  2011-10-11 12:05 ` AdaMagica
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Sauvage @ 2011-10-11 12:00 UTC (permalink / raw)


Using GNAT GPL 2011, I try to define a type that is an access to an in
out function, and the following example code [1] is illegal for the
compiler.

Is it an Ada 2012 restriction on using in out functions, a GNAT GPL
2011 limitation or a bug ?

Cheers,

[1]
-- gnatmake -gnat12 in_out_function_access_type.adb
procedure In_Out_Function_Access_Type is

   function Validate (Status : in out Boolean) return String
   is
   begin
      Status := True;
      return "command";
   end Validate;

   type Callback is access function (Status : in out Boolean) return
String;
   -- illegal  functions can only have "in" parameters.
   -- build successfully if the above line is commented
begin
   null;
end In_Out_Function_Access_Type;



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

* Re: Ada 2012 and type access to in out functions
  2011-10-11 12:00 Ada 2012 and type access to in out functions David Sauvage
@ 2011-10-11 12:05 ` AdaMagica
  2011-10-11 12:10 ` Yannick Duchêne (Hibou57)
  2011-10-12 10:25 ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: AdaMagica @ 2011-10-11 12:05 UTC (permalink / raw)


Definitely a bug.

Remember, Ada 2012 is not yet finished, and so isn't the compiler.



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

* Re: Ada 2012 and type access to in out functions
  2011-10-11 12:00 Ada 2012 and type access to in out functions David Sauvage
  2011-10-11 12:05 ` AdaMagica
@ 2011-10-11 12:10 ` Yannick Duchêne (Hibou57)
  2011-10-11 17:38   ` Adam Beneschan
  2011-10-12 10:25 ` Stephen Leake
  2 siblings, 1 reply; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-10-11 12:10 UTC (permalink / raw)


Le Tue, 11 Oct 2011 14:00:37 +0200, David Sauvage  
<david.sauvage@adalabs.com> a écrit:

> Using GNAT GPL 2011, I try to define a type that is an access to an in
> out function, and the following example code [1] is illegal for the
> compiler.
>
> Is it an Ada 2012 restriction on using in out functions, a GNAT GPL
> 2011 limitation or a bug ?
>
> Cheers,
>
> [1]
> -- gnatmake -gnat12 in_out_function_access_type.adb
> procedure In_Out_Function_Access_Type is
>
>    function Validate (Status : in out Boolean) return String
>    is
>    begin
>       Status := True;
>       return "command";
>    end Validate;
>
>    type Callback is access function (Status : in out Boolean) return
> String;
>    -- illegal  functions can only have "in" parameters.
>    -- build successfully if the above line is commented
> begin
>    null;
> end In_Out_Function_Access_Type;

Possibly not already implemented in GNAT 2011 so.

Sorry, can't test right now, as I don't have my Ada 2012 compiler (GNAT  
too), on hand. I just can tell you in/out parameters for functions are  
valid Ada 2012.

-- 
“Syntactic sugar causes cancer of the semi-colons.”  [Epigrams on  
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
Java: Write once, Never revisit



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

* Re: Ada 2012 and type access to in out functions
  2011-10-11 12:10 ` Yannick Duchêne (Hibou57)
@ 2011-10-11 17:38   ` Adam Beneschan
  2011-10-11 19:32     ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Beneschan @ 2011-10-11 17:38 UTC (permalink / raw)


On Oct 11, 5:10 am, Yannick Duchêne (Hibou57)
<yannick_duch...@yahoo.fr> wrote:

> > Using GNAT GPL 2011, I try to define a type that is an access to an in
> > out function, and the following example code [1] is illegal for the
> > compiler.
>
> > Is it an Ada 2012 restriction on using in out functions, a GNAT GPL
> > 2011 limitation or a bug ?
>
> > Cheers,
>
> > [1]
> > -- gnatmake -gnat12 in_out_function_access_type.adb
> > procedure In_Out_Function_Access_Type is
>
> >    function Validate (Status : in out Boolean) return String
> >    is
> >    begin
> >       Status := True;
> >       return "command";
> >    end Validate;
>
> >    type Callback is access function (Status : in out Boolean) return
> > String;
> >    -- illegal  functions can only have "in" parameters.
> >    -- build successfully if the above line is commented
> > begin
> >    null;
> > end In_Out_Function_Access_Type;
>
> Possibly not already implemented in GNAT 2011 so.
>
> Sorry, can't test right now, as I don't have my Ada 2012 compiler (GNAT  
> too), on hand. I just can tell you in/out parameters for functions are  
> valid Ada 2012.

Out of curiosity, what exactly were you thinking of
testing?  :) :) :)  And what question would it have answered?

                       -- Adam



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

* Re: Ada 2012 and type access to in out functions
  2011-10-11 17:38   ` Adam Beneschan
@ 2011-10-11 19:32     ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 6+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2011-10-11 19:32 UTC (permalink / raw)


Le Tue, 11 Oct 2011 19:38:33 +0200, Adam Beneschan <adam@irvine.com> a  
écrit:

> Out of curiosity, what exactly were you thinking of
> testing?  :) :) :)
Compiler result

> And what question would it have answered?
Perhaps suggest some build of GNAT to the original poster

Cheers


-- 
“Syntactic sugar causes cancer of the semi-colons.”  [Epigrams on  
Programming — Alan J. — P. Yale University]
“Structured Programming supports the law of the excluded muddle.” [Idem]
Java: Write once, Never revisit



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

* Re: Ada 2012 and type access to in out functions
  2011-10-11 12:00 Ada 2012 and type access to in out functions David Sauvage
  2011-10-11 12:05 ` AdaMagica
  2011-10-11 12:10 ` Yannick Duchêne (Hibou57)
@ 2011-10-12 10:25 ` Stephen Leake
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Leake @ 2011-10-12 10:25 UTC (permalink / raw)


David Sauvage <david.sauvage@adalabs.com> writes:

> Using GNAT GPL 2011, I try to define a type that is an access to an in
> out function, and the following example code [1] is illegal for the
> compiler.
>
> Is it an Ada 2012 restriction on using in out functions, a GNAT GPL
> 2011 limitation or a bug ?

Same error in GNAT 6.4.2. I'd guess it's a GNAT bug; they just haven't
implemented that part of Ada 2012 yet.

-- 
-- Stephe



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

end of thread, other threads:[~2011-10-12 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 12:00 Ada 2012 and type access to in out functions David Sauvage
2011-10-11 12:05 ` AdaMagica
2011-10-11 12:10 ` Yannick Duchêne (Hibou57)
2011-10-11 17:38   ` Adam Beneschan
2011-10-11 19:32     ` Yannick Duchêne (Hibou57)
2011-10-12 10:25 ` Stephen Leake

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