comp.lang.ada
 help / color / mirror / Atom feed
* qualified expression
@ 2021-02-08  9:02 Mehdi Saada
  2021-02-08 10:21 ` AdaMagica
  0 siblings, 1 reply; 5+ messages in thread
From: Mehdi Saada @ 2021-02-08  9:02 UTC (permalink / raw)


Is it possible to express within a qualified expression,
not a slice with all elements being the same, but a slice from another variable ?

type t_type (det: det_type := default_value) is record
          T_vect: t_arrays(0..det) := (others => null_value);
end record;
var2 : t_vect(1..det+1) :=...;
Like, usually it is: T_type'(det1, 0..det1 => Element)
there it would looks like T_type'(det1, 0..det1 =>  Var2(1..det1));
btw, shouln't the context here be sufficient for the expression to resolve ?

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

* Re: qualified expression
  2021-02-08  9:02 qualified expression Mehdi Saada
@ 2021-02-08 10:21 ` AdaMagica
  2021-02-08 11:47   ` Mehdi Saada
  2021-02-08 12:36   ` Jeffrey R. Carter
  0 siblings, 2 replies; 5+ messages in thread
From: AdaMagica @ 2021-02-08 10:21 UTC (permalink / raw)


0012...@gmail.com schrieb am Montag, 8. Februar 2021 um 10:02:57 UTC+1:

Terrible unreadable style!

> type t_type (det: det_type := default_value) is record 
> T_vect: t_arrays(0..det) := (others => null_value); 
> end record; 
> var2 : t_vect(1..det+1) :=...; 

var2: t_arrays(1..det+1);

> Like, usually it is: T_type'(det1, 0..det1 => Element)

T_type'(det1, (0..det1 => Element))   -- parentheses missing

> there it would looks like T_type'(det1, 0..det1 => Var2(1..det1)); 

T_type'(det1, Var2(1..det1+1));  -- positional, slides
T_type'(det1, T_Vect => Var2(1..det1+1));  -- mixed positional named

> btw, shouln't the context here be sufficient for the expression to resolve ?
Guess so.

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

* Re: qualified expression
  2021-02-08 10:21 ` AdaMagica
@ 2021-02-08 11:47   ` Mehdi Saada
  2021-02-08 16:18     ` AdaMagica
  2021-02-08 12:36   ` Jeffrey R. Carter
  1 sibling, 1 reply; 5+ messages in thread
From: Mehdi Saada @ 2021-02-08 11:47 UTC (permalink / raw)


> Terrible unreadable style!
My bad. But I so like qualified expression. and renames. and the more or less esoteric bits.
> T_type'(det1, Var2(1..det1+1)); -- positional, slides 
I know I can do that but since T_arrays and T_vect are 1) different types 2) more importantly do not have the same range (one starts at 0 the other at 1) so I was, and still am, unsure if the indices would be shifted in the conversion, or left as they are (1..det+1).
Without conversion, if these are just different array subtypes with different indice rangs same problem.
I just don't know the rules regards to index range... surely it's somewhere in the rm but good luck to me finding it.

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

* Re: qualified expression
  2021-02-08 10:21 ` AdaMagica
  2021-02-08 11:47   ` Mehdi Saada
@ 2021-02-08 12:36   ` Jeffrey R. Carter
  1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey R. Carter @ 2021-02-08 12:36 UTC (permalink / raw)


On 2/8/21 11:21 AM, AdaMagica wrote:
> 
> T_type'(det1, Var2(1..det1+1));  -- positional, slides
> T_type'(det1, T_Vect => Var2(1..det1+1));  -- mixed positional named

T_Type'(Det => Det1, T_Vect => Var2)

-- 
Jeff Carter
"People called Romanes, they go the house?"
Monty Python's Life of Brian
79

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

* Re: qualified expression
  2021-02-08 11:47   ` Mehdi Saada
@ 2021-02-08 16:18     ` AdaMagica
  0 siblings, 0 replies; 5+ messages in thread
From: AdaMagica @ 2021-02-08 16:18 UTC (permalink / raw)


0012...@gmail.com schrieb am Montag, 8. Februar 2021 um 12:47:18 UTC+1:
> I know I can do that but since T_arrays and T_vect are 1) different types

No, T_arrays is a type, T_vect a component of a type.

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

end of thread, other threads:[~2021-02-08 16:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  9:02 qualified expression Mehdi Saada
2021-02-08 10:21 ` AdaMagica
2021-02-08 11:47   ` Mehdi Saada
2021-02-08 16:18     ` AdaMagica
2021-02-08 12:36   ` Jeffrey R. Carter

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