comp.lang.ada
 help / color / mirror / Atom feed
* A non-primitive operation
@ 2017-11-14 19:44 Victor Porton
  2017-11-14 21:56 ` Dmitry A. Kazakov
  2017-11-15 22:37 ` Randy Brukardt
  0 siblings, 2 replies; 3+ messages in thread
From: Victor Porton @ 2017-11-14 19:44 UTC (permalink / raw)


I want a function F which returns a tagged type NOT to be considered as a 
primitive operation of T.

Is there any other way for this, except to declare F in a separate package?

What about creating F in a subpackage? This way it could have access to full 
view of T if T is private (an awful hack?):

package X is

  type T is tagged private;

  package Sub is
    function F return T;
  end Sub;

end X;

Are there other ways?

-- 
Victor Porton - http://portonvictor.org


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

* Re: A non-primitive operation
  2017-11-14 19:44 A non-primitive operation Victor Porton
@ 2017-11-14 21:56 ` Dmitry A. Kazakov
  2017-11-15 22:37 ` Randy Brukardt
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry A. Kazakov @ 2017-11-14 21:56 UTC (permalink / raw)


On 2017-11-14 20:44, Victor Porton wrote:
> I want a function F which returns a tagged type NOT to be considered as a
> primitive operation of T.

    function F return T'Class;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

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

* Re: A non-primitive operation
  2017-11-14 19:44 A non-primitive operation Victor Porton
  2017-11-14 21:56 ` Dmitry A. Kazakov
@ 2017-11-15 22:37 ` Randy Brukardt
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Brukardt @ 2017-11-15 22:37 UTC (permalink / raw)


A nested package is the usual way to do this, for the reasons that you 
stated.

Usually, the only routines that make sense to be treated that way are 
constructor functions (and even those may be better off being primitive, so 
that the generic dispatching constructor [or "factory"] can be used).

                            Randy.

"Victor Porton" <porton@narod.ru> wrote in message 
news:oufm3f$1s0q$1@gioia.aioe.org...
>I want a function F which returns a tagged type NOT to be considered as a
> primitive operation of T.
>
> Is there any other way for this, except to declare F in a separate 
> package?
>
> What about creating F in a subpackage? This way it could have access to 
> full
> view of T if T is private (an awful hack?):
>
> package X is
>
>  type T is tagged private;
>
>  package Sub is
>    function F return T;
>  end Sub;
>
> end X;
>
> Are there other ways?
>
> -- 
> Victor Porton - http://portonvictor.org 



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

end of thread, other threads:[~2017-11-15 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-14 19:44 A non-primitive operation Victor Porton
2017-11-14 21:56 ` Dmitry A. Kazakov
2017-11-15 22:37 ` Randy Brukardt

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