From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8f2146b9c1ab93cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-04 21:09:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!novia!novia!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail From: "Eric G. Miller" Subject: Re: Upping the ante (was): ToString? Newsgroups: comp.lang.ada Message-ID: References: <3C918515.20808@worldnet.att.net> <6e9cd02332705638a4cd86a4a2f521e7.48257@mygate.mailgate.org> User-Agent: Pan/0.11.2 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: "Kent Paul Dolan" Date: Fri, 05 Apr 2002 05:09:51 GMT NNTP-Posting-Host: 216.119.53.41 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1017983391 216.119.53.41 (Thu, 04 Apr 2002 21:09:51 PST) NNTP-Posting-Date: Thu, 04 Apr 2002 21:09:51 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:22129 Date: 2002-04-05T05:09:51+00:00 List-Id: In <6e9cd02332705638a4cd86a4a2f521e7.48257@mygate.mailgate.org>, Kent Paul Dolan wrote: > "Jim Rogers" 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.