comp.lang.ada
 help / color / mirror / Atom feed
From: "Jérémie Lumbroso" <jeremie.lumbroso@gmail.com>
Subject: Extended 'Succ attribute?
Date: 22 Nov 2006 16:55:09 -0800
Date: 2006-11-22T16:55:09-08:00	[thread overview]
Message-ID: <1164243308.957573.223990@l39g2000cwd.googlegroups.com> (raw)

Hello,

I just started Ada and was wondering if there is a way to make the Succ
attribute of discrete types behave in a cyclic manner (akin to the
modular type):

    type T_DAY is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);

    ...

    day := T_DAY'(Sun);
    day := T_DAY'Succ(day);  -- that this returns 'Mon' instead of
                             -- a type constraint error

I could of course define my own function to do this, but I wish to know
if there is a way to get Ada to do it itself.

Regards,

Jérémie




             reply	other threads:[~2006-11-23  0:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23  0:55 Jérémie Lumbroso [this message]
2006-11-23  2:04 ` Extended 'Succ attribute? Adam Beneschan
2006-11-24 13:02   ` Peter Hermann
2006-11-23  6:38 ` Jeffrey R. Carter
replies disabled

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