From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: worrying behaviour
Date: Fri, 2 May 2008 20:15:14 -0500
Date: 2008-05-02T20:15:14-05:00 [thread overview]
Message-ID: <fvgecn$f55$1@jacob-sparre.dk> (raw)
In-Reply-To: ea92a206-7617-4968-90c2-31fcc30d5e40@r9g2000prd.googlegroups.com
"Adam Beneschan" <adam@irvine.com> wrote in message
news:ea92a206-7617-4968-90c2-31fcc30d5e40@r9g2000prd.googlegroups.com...
...
> I'm not sure that there's a good solution in Ada. If you really
> wanted to make sure that the only operators available for My_Int are
> the ones that you remembered to override, you could declare My_Int
> private, but then you'd lose the ability to have numeric literals for
> that type (in other packages). I suppose that having some sort of
> language construct that says "kill all predefined operators for a
> type" would be useful in your case.
That's not available, but you can kill them one-by-one by declaring them
abstract:
function "-" (R : My_Int) return My_int is abstract;
makes "-" effectively undefined for type My_Int. (This is new in Ada 2005,
in Ada 95 it is defined and uncallable -- the difference is that it might
conflict with some user-defined routine and cause trouble.)
Randy.
next prev parent reply other threads:[~2008-05-03 1:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 15:26 worrying behaviour echancrure
2008-05-02 15:54 ` Adam Beneschan
2008-05-02 17:41 ` echancrure
2008-05-02 18:31 ` Adam Beneschan
2008-05-03 1:15 ` Randy Brukardt [this message]
2008-05-03 2:04 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox