comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone"
Date: Wed, 24 Feb 2021 16:13:31 -0800 (PST)	[thread overview]
Message-ID: <10e39f4a-9253-4faf-93af-b57ccad92526n@googlegroups.com> (raw)
In-Reply-To: <a69451b6-9c4d-4d6a-a4c1-51c532d06bf0n@googlegroups.com>

Okay, point by point.
type Cards_number is range 0..52;
sorry lingering French

> type CARDS is new cards_numbers range 1..52;
> when 1 => put("Spades");
> when 2 => put("Hearts");
> when 3 => put("diamonds");
> when 4 => put("clubs");
> end case;

I didn't know half the terms in English. Nor that it was called a "suit"... I read novels but simple terms like this, nope..

> type Cards_Numbers'Base is range /implementation_defined/;
> type Cards'Base is new Cards_Numbers'Base;
I didn't get the meaning of 'Base before. ok.

> Note also that 52 / 13 + 1 = 5.
> If you write what you mean, you would have
Yes... I prefered being looking in the mirror and seeing a smartass with a math expression, to get myself ridiculous here, writing it wrong.
Ignoring this, could the compiler see that the expression has a limited number of possible results ? or a side tool ?

Never make it complicated and mathematics when it can be static and plain. Ok.
Morale: I have trouble not choosing names in a sorely confusing ðæµning way, even with care, đ↓¢ĸ, ßħ→ŧ !

> Yeah, here you're straight-up trying to overwrite the discriminant.
But I'm assigning a record aggregate to a mutable type object (so with a default disciminant).
So why does it matter if the component's subtype is constrained (here by the discriminant, but whatever) ?
It's the very point of mutable objects, to cope with these assignments... or What am I missing ?
That's the last issue remaining.

  reply	other threads:[~2021-02-25  0:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  0:14 "unconstrained subtype in component declaration" vs "discriminant in constraint must appear alone" Mehdi Saada
2021-02-22  6:32 ` J-P. Rosen
2021-02-22 10:14   ` AdaMagica
2021-02-22 10:57     ` Dmitry A. Kazakov
2021-02-22 14:20       ` Mehdi Saada
2021-02-22 15:11         ` J-P. Rosen
2021-02-22 15:55         ` Dmitry A. Kazakov
2021-02-22 16:21           ` Mehdi Saada
2021-02-23 22:06             ` Mehdi Saada
2021-02-24  9:59               ` AdaMagica
2021-02-24 10:04               ` Jeffrey R. Carter
2021-02-24 14:11               ` Simon Wright
2021-02-24 15:57               ` Shark8
2021-02-25  0:13                 ` Mehdi Saada [this message]
2021-02-25  8:58                   ` AdaMagica
2021-02-25 10:25                     ` Mehdi Saada
2021-02-25 10:28                     ` Mehdi Saada
2021-02-22 10:35 ` Jeffrey R. Carter
2021-02-22 14:21   ` Mehdi Saada
2021-02-22 15:02     ` Jeffrey R. Carter
2021-02-22 15:08       ` J-P. Rosen
replies disabled

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