comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: why "unconstrained subtype in component declaration" while said component given default value ?
Date: Tue, 29 May 2018 10:20:17 -0700 (PDT)
Date: 2018-05-29T10:20:17-07:00	[thread overview]
Message-ID: <f1c6c12d-8010-4796-a145-75898d8ec312@googlegroups.com> (raw)
In-Reply-To: <10ae91d6-d6cd-4afe-87d5-2cfd9ff41d79@googlegroups.com>

>   type Unconstrained_Collection
>     (Maximum_Size : Positive) is new Abstract_Collection with private;

>   subtype Collection
>      is Unconstrained_Collection (Maximum_Size => Maximum_Size);

It's close, but I would like to hide publicly the discriminants. I would like:
one unconstrained subtype with (<>) which needs initialization, and one subtype who doesn't need it. In fact, I don't need necessarily subtypes:
I could have:
type A(<>) is private;
type B is private;
private
  type A( - discriminants with or without defaults -) is ...
  subtype B is A ( some values); -- not possible, I already complained about it.

I can already get what I want if B is made a derived type of A. No need for tagged types here.

  reply	other threads:[~2018-05-29 17:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 21:03 why "unconstrained subtype in component declaration" while said component given default value ? Mehdi Saada
2018-05-26 21:40 ` Jere
2018-05-26 22:11   ` Mehdi Saada
2018-05-26 23:55     ` Jere
2018-05-27  0:14       ` Jere
2018-05-27  0:29       ` Mehdi Saada
2018-05-27  0:45         ` Mehdi Saada
2018-05-27 17:15         ` Shark8
2018-05-27 17:30           ` AdaMagica
2018-05-27 18:17             ` Shark8
2018-05-29  1:28               ` AdaMagica
2018-05-29 17:20                 ` Mehdi Saada [this message]
2018-05-27  7:45   ` Jeffrey R. Carter
2018-05-26 23:41 ` Shark8
2018-05-27  7:07 ` Simon Wright
2018-05-27 17:22   ` Shark8
2018-05-27 12:24 ` Mehdi Saada
2018-05-29 22:28   ` Randy Brukardt
replies disabled

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