Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: worrying be...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 5681 of 5800
Post > Topic >>

Re: worrying behaviour

by "Randy Brukardt" <randy@[EMAIL PROTECTED] > May 2, 2008 at 08:15 PM

"Adam Beneschan" <adam@[EMAIL PROTECTED]
> wrote in message
news:ea92a206-7617-4968-90c2-31fcc30d5e40@[EMAIL PROTECTED]
> 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.
 




 6 Posts in Topic:
worrying behaviour
echancrure@[EMAIL PROTECT  2008-05-02 08:26:14 
Re: worrying behaviour
Adam Beneschan <adam@[  2008-05-02 08:54:01 
Re: worrying behaviour
"Randy Brukardt"  2008-05-02 20:15:14 
Re: worrying behaviour
echancrure@[EMAIL PROTECT  2008-05-02 10:41:01 
Re: worrying behaviour
Adam Beneschan <adam@[  2008-05-02 11:31:31 
Re: worrying behaviour
Adam Beneschan <adam@[  2008-05-02 19:04:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:55:25 CDT 2008.