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 X-Received: by 2002:a5e:c74b:: with SMTP id g11-v6mr4436068iop.38.1538761591251; Fri, 05 Oct 2018 10:46:31 -0700 (PDT) X-Received: by 2002:aca:7552:: with SMTP id q79-v6mr219247oic.1.1538761590897; Fri, 05 Oct 2018 10:46:30 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!2.eu.feeder.erje.net!4.us.feeder.erje.net!feeder.erje.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!x98-v6no93925ita.0!news-out.google.com!n199-v6ni124itn.0!nntp.google.com!z5-v6no92869ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 5 Oct 2018 10:46:30 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2001:14bb:51:2563:5c83:217e:4aa9:f00; posting-account=9KbC2woAAAA0kK2IAUr3-FkzJBtOzrhm NNTP-Posting-Host: 2001:14bb:51:2563:5c83:217e:4aa9:f00 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0f5608ef-0038-491c-b15f-f67bcc76fae8@googlegroups.com> Subject: Record operations (Algebraic Data Types and printing) From: =?UTF-8?B?SGVucmlrIEjDpHJrw7ZuZW4=?= Injection-Date: Fri, 05 Oct 2018 17:46:31 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54486 Date: 2018-10-05T10:46:30-07:00 List-Id: Hi! (Very) Slowly getting my Ada wheels rolling, didn't get the book yet et= c. but anyway... I'm coming from Scala world most recently and I like to leverage Algebraic = Data Types (through sealed traits), or Discriminated Unions, as they were c= alled in F#. I was happy to find out that Ada has Variant Record, which I b= elieve pretty much covers the same thing. Maybe in a bit more verbose way. = :) I'm somehow fascinated by the possibility to carry state as the type, th= us with different data items for each state. Now as I'm playing with the records, I'd like to print them out, just for "= debugging" purposes. Is there any convenient way to splash them out in cons= ole? Some sort of default string representation? Seems that 'Image attribut= e works only for scalar types. -Henrik