comp.lang.ada
 help / color / mirror / Atom feed
From: peter.h.m.brooks@gmail.com (Peter Brooks)
Subject: Re: Variant record limitation - what's a better solution?
Date: Tue, 9 Jul 2013 06:38:09 +0000 (UTC)
Date: 2013-07-09T06:38:09+00:00	[thread overview]
Message-ID: <krgb4h$qe8$3@news.albasani.net> (raw)
In-Reply-To: 0606a658-9816-4611-84dd-4f999bf6018e@googlegroups.com

Peter Brooks <peter.h.m.brooks@gmail.com> wrote:

I'm still having trouble with this. I've tried using functions, as suggested, but it doesn't allow overloaded functions in the varient part. Here's what I tried:


"
type
small_lorry_load is new integer range 1..2;
type
medium_lorry_load is new integer range 1..18;
type
large_lorry_load is new integer range 1..36;
type
all_lorry_loads is new integer range 1..36;

type
lorry_size is (small,medium,large);

type
lorry_number_plate is new string(1..8);

function load(x : lorry_size := small) return small_lorry_load;
function load(x : lorry_size := medium) return  medium_lorry_load;
function load(x : lorry_size := large) return large_lorry_load;


type
lorry_type(lorry : lorry_size) is
        record
                number_plate : lorry_number_plate;
                location : depot_name_type;
                destination : depot_name_type;
                case lorry is
                        when small => lorry_load : load(lorry);
                        when medium => lorry_load : load(lorry);
                        when large => lorry_load : load(lorry);
                end case;
        end record;
"

I know that the syntax is wrong - I've been trying all sorts of alternatives. What have I not understood?


  parent reply	other threads:[~2013-07-09  6:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03  7:52 Variant record limitation - what's a better solution? Peter Brooks
2013-07-03  8:11 ` Georg Bauhaus
2013-07-03  9:39   ` Peter Brooks
2013-07-03 16:23 ` Jeffrey Carter
2013-07-03 18:35 ` Shark8
2013-07-03 19:26 ` Adam Beneschan
2013-07-09 11:48   ` Peter Brooks
2013-07-09 15:11     ` Adam Beneschan
2013-07-10  1:11       ` Peter Brooks
2013-07-03 20:55 ` Per Sandberg
2013-07-09  6:38 ` Peter Brooks [this message]
2013-07-09  7:49   ` Simon Wright
2013-07-09  8:22   ` Georg Bauhaus
2013-07-09 14:12   ` Eryndlia Mavourneen
replies disabled

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