comp.lang.ada
 help / color / mirror / Atom feed
* Extended 'Succ attribute?
@ 2006-11-23  0:55 Jérémie Lumbroso
  2006-11-23  2:04 ` Adam Beneschan
  2006-11-23  6:38 ` Jeffrey R. Carter
  0 siblings, 2 replies; 4+ messages in thread
From: Jérémie Lumbroso @ 2006-11-23  0:55 UTC (permalink / 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




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

end of thread, other threads:[~2006-11-24 13:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-23  0:55 Extended 'Succ attribute? Jérémie Lumbroso
2006-11-23  2:04 ` Adam Beneschan
2006-11-24 13:02   ` Peter Hermann
2006-11-23  6:38 ` 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