From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.albasani.net!.POSTED!not-for-mail From: peter.h.m.brooks@gmail.com (Peter Brooks) Newsgroups: comp.lang.ada Subject: Re: Variant record limitation - what's a better solution? Date: Tue, 9 Jul 2013 06:38:09 +0000 (UTC) Organization: albasani.net Message-ID: References: <0606a658-9816-4611-84dd-4f999bf6018e@googlegroups.com> X-Trace: news.albasani.net Dgd9yQe8b+Nl9Sei0q4kGcwOoytjv2i1N+iUA0y7Js0g+xrU7CmuwoM13xVaPm3jEKcBTIDjMs//lT9+Z9bz2UszYp72i/1In4DveWffG1GVS4iWEwFUQIRqIY+IVg+q NNTP-Posting-Date: Tue, 9 Jul 2013 06:38:09 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="DDq6/aUq1qTEYPyBaIKS42NmWuhF2b3OaCRlR9B3CTKR6poAjAd32DvjGzhr1yseFwyrOPnj41FdYmTni/8GLH/xhR4h2GmGUVlVRNcdjWfW9RJDEignShovUpAW2Awc"; mail-complaints-to="abuse@albasani.net" User-Agent: tin/2.1.2-20121224 ("Langholm") (UNIX) (Darwin/12.4.0 (x86_64)) Cancel-Lock: sha1:ax0kdXDLVvWm0MMW0SoPy5qLx2Q= Xref: news.eternal-september.org comp.lang.ada:16186 Date: 2013-07-09T06:38:09+00:00 List-Id: Peter Brooks 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?