comp.lang.ada
 help / color / mirror / Atom feed
* A function that cannot be called?
@ 2018-10-18 12:14 G.B.
  2018-10-18 15:33 ` Stefan.Lucks
                   ` (3 more replies)
  0 siblings, 4 replies; 41+ messages in thread
From: G.B. @ 2018-10-18 12:14 UTC (permalink / raw)


There is a type declaration, I rememberd, in Ada, that
does not allow any object of the type to be declared.
I think the type should be along the lines below. Is
this correct?

Then, a function that nominally returns objects of
this type should be impossible to call. Is this right,
too?

generic
     type T(<>) is limited private;  -- gen. arg. type

package What is

     type Void (<>) is private;

     function Impossible (X : T) return Void;

private

     package Inner is
         type Void (<>) is private;
     private
         type Void is  record
             null;
         end record;
     end Inner;

     type Void is new Inner.Void;

end What;

(If current Ada could still pass by reference in both call
direction and return direction, then I'd have added *limited*
to the Voids' declarations. Without it, a body of Impossible
is closer to becoming possible by using Convention => Ada
together with an 'Address clause on a Result object. I think.)

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

end of thread, other threads:[~2018-10-24  8:14 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 12:14 A function that cannot be called? G.B.
2018-10-18 15:33 ` Stefan.Lucks
2018-10-18 20:21   ` G.B.
2018-10-18 20:57     ` Niklas Holsti
2018-10-19  7:15     ` Dmitry A. Kazakov
2018-10-19 13:55       ` G.B.
2018-10-19 15:31         ` Dmitry A. Kazakov
2018-10-18 17:03 ` AdaMagica
2018-10-18 19:36   ` G.B.
2018-10-18 21:30     ` Randy Brukardt
2018-10-19 14:00       ` G.B.
2018-10-19 15:39         ` Dmitry A. Kazakov
2018-10-20  1:34         ` Randy Brukardt
2018-10-20  9:14           ` G.B.
2018-10-20 11:13             ` Simon Wright
2018-10-20 14:11               ` Dmitry A. Kazakov
2018-10-21  9:25                 ` G.B.
2018-10-21  9:07               ` G.B.
2018-10-21  9:51                 ` Dmitry A. Kazakov
2018-10-21 10:57                 ` Niklas Holsti
2018-10-21 18:00                 ` Simon Wright
2018-10-19  8:48 ` AdaMagica
2018-10-19 11:15   ` G.B.
2018-10-19 17:06     ` AdaMagica
2018-10-19 19:57       ` G.B.
2018-10-19 22:06         ` Jere
2018-10-21 10:14           ` G.B.
2018-10-21 11:30             ` Egil H H
2018-10-23 11:45               ` G.B.
2018-10-23 14:35                 ` Jere
2018-10-23 14:57                   ` Dmitry A. Kazakov
2018-10-23 17:49                     ` G.B.
2018-10-23 19:25                       ` Dmitry A. Kazakov
2018-10-24  7:35                         ` G.B.
2018-10-24  8:14                           ` Dmitry A. Kazakov
2018-10-19 18:19 ` marciant
2018-10-19 18:22   ` marciant
2018-10-20  1:36     ` Randy Brukardt
2018-10-20  2:54       ` marciant
2018-10-19 20:25   ` Shark8
2018-10-19 23:28     ` marciant

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