comp.lang.ada
 help / color / mirror / Atom feed
From: "Eric G. Miller" <egm2@jps-nospam.net>
Subject: Re: Upping the ante (was): ToString?
Date: Fri, 05 Apr 2002 05:09:51 GMT
Date: 2002-04-05T05:09:51+00:00	[thread overview]
Message-ID: <pan.2002.04.04.21.10.34.608997.22587@jps-nospam.net> (raw)
In-Reply-To: 6e9cd02332705638a4cd86a4a2f521e7.48257@mygate.mailgate.org

In <6e9cd02332705638a4cd86a4a2f521e7.48257@mygate.mailgate.org>, Kent Paul Dolan wrote:

> "Jim Rogers" <jimmaureenrogers@worldnet.att.net> wrote:
> 
>> Unfortunately, there is no such implied contract in Java.
> 
>> Every object (non-primitive type) will have a toString() method.
>> It may not do anything sensible. If you define your own class
>> and do NOT override the toString() inherited from the Object
>> class your output will only be the class name followed by the
>> output of the hashCode() method for your class.
> 
> But the java SDK API docs recommend exactly that for every class, you
> override this behavior inherited from Object, wherever some other
> toString() implementation makes more sense for your object, which is why
> I consider this to be an implied contract.  If you don't keep the
> contract, and go with the default, you deserve the results, it seems to
> me.
> 
> In any case, such universal meta-programming rules would seem useful for
> Ada, beyond just the idea of a style guide.  Do such exist?  Does a
> repository of them exist?

Implied contracts don't hold up in court.  Especially when they only
make recommendations...

Q. "Why didn't you follow your neighbor's recommendation to mow the lawn?"
A. "I like dandelions."

Recommendation:  You should not park junk cars in your front yard.
Result: Neighborhood full of junk cars parked in the front yard.



  reply	other threads:[~2002-04-05  5:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-12 13:16 ToString? Nazgul
2002-03-12 13:24 ` ToString? Peter Hermann
2002-03-12 13:25 ` ToString? Ingo Marks
2002-03-12 13:27 ` ToString? Larry Hazel
2002-03-12 13:30 ` ToString? Martin Dowie
2002-03-12 16:48   ` ToString? Jeffrey Carter
2002-03-13  8:38     ` ToString? Martin Dowie
2002-03-13 22:18       ` ToString? Jeffrey Carter
2002-03-14  0:36         ` ToString? Adrian Knoth
2002-03-15  4:58 ` Upping the ante (was): ToString? Kent Paul Dolan
2002-03-15  5:22   ` Jim Rogers
2002-04-04 23:21     ` Kent Paul Dolan
2002-04-05  5:09       ` Eric G. Miller [this message]
2002-04-05 19:45         ` Kent Paul Dolan
2002-04-06  4:07           ` Eric G. Miller
2002-04-06 22:23             ` Implied Programming contracts: " Kent Paul Dolan
replies disabled

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