comp.lang.ada
 help / color / mirror / Atom feed
* Ada2012 : Expression functions and extended return statements
@ 2012-01-06  8:45 Martin
  2012-01-06  9:45 ` stefan-lucks
                   ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Martin @ 2012-01-06  8:45 UTC (permalink / raw)


Am I correct in thinking these 2 parts of the language can't be
'mixed'?...

There doesn't seem to be anything that allows anything like, e.g.

package Foo is
   type T (<>) is tagged private;
   function Create return T is
      (Result : T do Result.I := 1);
private
   type T is tagged record
      I : Integer;
   end record;
end Foo;

Also, on the topic of extended return statements...

What's the rational for having to explicitly repeat the return type?
Seems rather redundant to my eyes. I wouldn't have minded:

function Bar return Some_Type is
begin
   return Result : <> do
      -- something to initialise 'Result'
   end return;
end Bar;

or even

function Bar return Some_Type is
begin
   return Result do
      -- something to initialise 'Result'
   end return;
end Bar;

In this case, 'Result' can't be anything other than of type
'Some_Type' can it?

-- Martin



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

end of thread, other threads:[~2012-01-31 23:34 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-06  8:45 Ada2012 : Expression functions and extended return statements Martin
2012-01-06  9:45 ` stefan-lucks
2012-01-06 10:02   ` Martin
2012-01-06 11:23     ` Peter C. Chapin
2012-01-06 11:37       ` Martin
2012-01-06 13:13         ` Dmitry A. Kazakov
2012-01-06 14:45           ` Martin Dowie
2012-01-06 15:07             ` Martin
2012-01-06 16:40             ` Robert A Duff
2012-01-06 17:04               ` Martin Dowie
2012-01-19  7:47               ` David Thompson
2012-01-06 17:20             ` Dmitry A. Kazakov
2012-01-07  1:47               ` Randy Brukardt
2012-01-07  9:21                 ` Dmitry A. Kazakov
2012-01-06 16:45           ` Adam Beneschan
2012-01-06 16:36     ` Adam Beneschan
2012-01-07 14:54     ` stefan-lucks
2012-01-07 15:11       ` Dmitry A. Kazakov
2012-01-08  9:41         ` stefan-lucks
2012-01-09  6:16         ` Randy Brukardt
2012-01-06 15:11   ` J-P. Rosen
2012-01-06 15:26     ` Martin
2012-01-07  1:50       ` Randy Brukardt
2012-01-07 10:12         ` Martin
2012-01-07 12:22           ` Simon Wright
2012-01-07 17:10             ` Martin
2012-01-09  6:21           ` Randy Brukardt
2012-01-09  7:57             ` Martin Dowie
2012-01-31 23:34             ` Yannick Duchêne (Hibou57)
2012-01-06 16:33 ` Adam Beneschan
2012-01-06 16:38   ` Adam Beneschan
2012-01-06 22:12     ` Robert A Duff
2012-01-31 23:20 ` Yannick Duchêne (Hibou57)

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