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 5 of 6 Topic 5681 of 5831
Post > Topic >>

Re: worrying behaviour

by Adam Beneschan <adam@[EMAIL PROTECTED] > May 2, 2008 at 11:31 AM

On May 2, 10:41 am, echancr...@[EMAIL PROTECTED]
 wrote:

> Thanks Adam for your comprehensive answer.
> I know there is no error here, I just thought that if you explicitly
> bother to provide a renaming operator declaration it would be
> reasonable for the compiler to expect an explicit definition for it...

Not at all; I think it's quite common to rename implicitly declared
operators.


> Of course declaring the type private would highlight the problem
> but ... are you really sure that in the real world those mistakes are
> not made? (would be pretty hard to detect and would probably only be
> revealed on boundary cases)

They may well be made.  But a compiler can't reasonably catch all
mistakes.


> After all what is the point of renaming an operator and not provide an
> actual body for it but the default one?

To be able to use the operator without having to USE the package.  USE
TYPE makes this less necessary, but there's a lot of legacy code out
there written before Ada 95.  Also, there may be reasons why USE TYPE
is undesirable in particular situations, but I'm not sure what they
are... perhaps others could elaborate if there are.

Actually, now that I think of it, your question doesn't make that much
sense.  Other than the reason I've alluded to (i.e. making an operator
visible), I don't see any point to renaming an operator that *does*
have an actual body for it---I don't see why the explicitness or
implicitness of the operator's definition makes any difference.

(There are cases where you need a rename to avoid an ambiguity, but in
those cases you wouldn't be renaming an operator to the same operator
string, so I'm assuming that case isn't relevant to this discussion.)

                             -- Adam
 




 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 Fri Jul 25 20:45:49 CDT 2008.